From 88281bff5669bd4e7c798a74c9717ac5749f7379 Mon Sep 17 00:00:00 2001 From: Phil Sphicas Date: Wed, 9 Sep 2020 06:31:40 +0000 Subject: [PATCH] Fix bug with block_literal_representer When serializing a block literal, be explicit that we want to treat it as a string, instead of relying on implicit conversion. Change-Id: I01a06c49f6112ef3e4313030ada0a7ea6adb5fb4 --- pegleg/engine/catalog/pki_utility.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pegleg/engine/catalog/pki_utility.py b/pegleg/engine/catalog/pki_utility.py index e39212ed..a755d237 100644 --- a/pegleg/engine/catalog/pki_utility.py +++ b/pegleg/engine/catalog/pki_utility.py @@ -350,7 +350,8 @@ class block_literal(str): def block_literal_representer(dumper, data): - return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|') + return dumper.represent_scalar( + 'tag:yaml.org,2002:str', str(data), style='|') yaml.add_representer(block_literal, block_literal_representer)