summaryrefslogtreecommitdiff
path: root/representer.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-05-30 09:25:32 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-05-30 09:25:32 +0200
commit73f4bec5f498b31fd7ce7c2ac7ced187b4fc4920 (patch)
treee2318c5891b58aecebdb178636c61b7aa6a84193 /representer.py
parent17b35c376fd0fc9a94ba0adfdbf5bf63a6177dc9 (diff)
downloadruamel.yaml-73f4bec5f498b31fd7ce7c2ac7ced187b4fc4920.tar.gz
fix for issue 3840.17.5
aliased scalars in !!set would not round trip with ?
Diffstat (limited to 'representer.py')
-rw-r--r--representer.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/representer.py b/representer.py
index f3e3e43..4b78c65 100644
--- a/representer.py
+++ b/representer.py
@@ -837,13 +837,17 @@ class RoundTripRepresenter(SafeRepresenter):
for ct in node.comment[1]:
ct.reset()
item_comments = comment.items
- for v in item_comments.values():
- if v and v[1]:
- for ct in v[1]:
- ct.reset()
- try:
- node.comment.append(comment.end)
- except AttributeError:
+ if self.dumper.comment_handling is None:
+ for v in item_comments.values():
+ if v and v[1]:
+ for ct in v[1]:
+ ct.reset()
+ try:
+ node.comment.append(comment.end)
+ except AttributeError:
+ pass
+ else:
+ # NEWCMNT
pass
except AttributeError:
item_comments = {}