summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--README.rst8
-rw-r--r--__init__.py4
-rw-r--r--_doc/_static/pypi.svg2
-rw-r--r--comments.py5
5 files changed, 16 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index b157860..bb6f0ae 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+[0, 15, 84]: 2019-01-07
+ - fix for `CommentedMap.copy()` not returning `CommentedMap`, let alone copying comments etc.
+ (reported by `Anthony Sottile <https://bitbucket.org/asottile/>`__)
+
[0, 15, 83]: 2019-01-02
- fix for bug in roundtripping aliases used as key (reported via email by Zaloo)
diff --git a/README.rst b/README.rst
index 829f209..f42a5bd 100644
--- a/README.rst
+++ b/README.rst
@@ -4,8 +4,8 @@ ruamel.yaml
``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python.
-:version: 0.15.83
-:updated: 2019-01-02
+:version: 0.15.84
+:updated: 2019-01-07
:documentation: http://yaml.readthedocs.io
:repository: https://bitbucket.org/ruamel/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -54,6 +54,10 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key (with empty line)
+0.15.84 (2019-01-07):
+ - fix for `CommentedMap.copy()` not returning `CommentedMap`, let alone copying comments etc.
+ (reported by `Anthony Sottile <https://bitbucket.org/asottile/>`__)
+
0.15.83 (2019-01-02):
- fix for bug in roundtripping aliases used as key (reported via email by Zaloo)
diff --git a/__init__.py b/__init__.py
index d71c2d4..5719064 100644
--- a/__init__.py
+++ b/__init__.py
@@ -7,8 +7,8 @@ if False: # MYPY
_package_data = dict(
full_package_name='ruamel.yaml',
- version_info=(0, 15, 83),
- __version__='0.15.83',
+ version_info=(0, 15, 84),
+ __version__='0.15.84',
author='Anthon van der Neut',
author_email='a.van.der.neut@ruamel.eu',
description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA
diff --git a/_doc/_static/pypi.svg b/_doc/_static/pypi.svg
index 5b4aa86..f62388f 100644
--- a/_doc/_static/pypi.svg
+++ b/_doc/_static/pypi.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h53v20H33z"/><path fill="url(#b)" d="M0 0h86v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="585" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">0.15.83</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.83</text></g> </svg>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h53v20H33z"/><path fill="url(#b)" d="M0 0h86v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="585" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">0.15.84</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.84</text></g> </svg>
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