summaryrefslogtreecommitdiff
path: root/comments.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-08-25 21:30:55 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-08-25 21:30:55 +0200
commitb377e99595919aded00074a2db16001c4847fce8 (patch)
tree8ec452e26419b22e45ed702359e1bd74115491c6 /comments.py
parent849ef8a1a635186e57a414858937b5759101a2a2 (diff)
downloadruamel.yaml-b377e99595919aded00074a2db16001c4847fce8.tar.gz
fix issue with insert in merged-in dict0.17.14
Diffstat (limited to 'comments.py')
-rw-r--r--comments.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/comments.py b/comments.py
index 4b6f03e..6d1c4d8 100644
--- a/comments.py
+++ b/comments.py
@@ -881,8 +881,13 @@ class CommentedMap(ordereddict, CommentedBase):
"""insert key value into given position
attach comment if provided
"""
+ keys = list(self.keys()) + [key]
ordereddict.insert(self, pos, key, value)
- self._ok.add(key)
+ for keytmp in keys:
+ self._ok.add(keytmp)
+ for referer in self._ref:
+ for keytmp in keys:
+ referer.update_key_value(keytmp)
if comment is not None:
self.yaml_add_eol_comment(comment, key=key)