summaryrefslogtreecommitdiff
path: root/comments.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-01-07 13:29:52 +0100
committerAnthon van der Neut <anthon@mnt.org>2019-01-07 13:29:52 +0100
commitec580a754862bdd03ef6cfd6133e5b190c5f1798 (patch)
tree05d078070c398519625d8501f128ed2f66d94b70 /comments.py
parent47574a96e90ca4199f50ae134211134e404a9bb1 (diff)
downloadruamel.yaml-ec580a754862bdd03ef6cfd6133e5b190c5f1798.tar.gz
fixes issue #269 CommentedMap.copy() not returning CommentedMap0.15.84
*When this change indeed resolves your problem, please **Close** this issue*. *(You can do so using the WorkFlow pull-down (close to the top right of this page))*
Diffstat (limited to 'comments.py')
-rw-r--r--comments.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/comments.py b/comments.py
index 1460a56..2015cca 100644
--- a/comments.py
+++ b/comments.py
@@ -908,9 +908,10 @@ class CommentedMap(ordereddict, CommentedBase):
def copy(self):
# type: () -> Any
- x = {} # update doesn't work
+ x = type(self)() # update doesn't work
for k, v in self._items():
x[k] = v
+ self.copy_attributes(x)
return x
def add_referent(self, cm):
@@ -944,7 +945,7 @@ class CommentedMap(ordereddict, CommentedBase):
memo[id(self)] = res
for k in self:
res[k] = copy.deepcopy(self[k])
- self.copy_attributes(res, deep=True)
+ self.copy_attributes(res, deep=True)
return res