summaryrefslogtreecommitdiff
path: root/constructor.py
diff options
context:
space:
mode:
Diffstat (limited to 'constructor.py')
-rw-r--r--constructor.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/constructor.py b/constructor.py
index 6a26da3..c830580 100644
--- a/constructor.py
+++ b/constructor.py
@@ -979,7 +979,10 @@ class RoundTripConstructor(SafeConstructor):
)
if node.style == '|' and isinstance(node.value, text_type):
- return PreservedScalarString(node.value)
+ pss = PreservedScalarString(node.value)
+ if node.comment and node.comment[1]:
+ pss.comment = node.comment[1][0]
+ return pss
elif bool(self._preserve_quotes) and isinstance(node.value, text_type):
if node.style == "'":
return SingleQuotedScalarString(node.value)