summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2019-07-17 09:53:27 +0200
committerAnthon van der Neut <anthon@mnt.org>2019-07-17 09:53:27 +0200
commit0427670ffa4fd8f70824dbf9533514f9a4daeff3 (patch)
tree5ac3fdfa799aa2f48510a1f3e9cd7bcbdf373785
parent9eb543eb3b1512a176f12ae6e4ba46ca6acf1b84 (diff)
downloadruamel.yaml-0427670ffa4fd8f70824dbf9533514f9a4daeff3.tar.gz
allow dump of deepcopied data from commented YAML0.15.100
fixes issue #295 *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))*
-rw-r--r--CHANGES13
-rw-r--r--README.rst11
-rw-r--r--__init__.py4
-rw-r--r--_doc/_static/pypi.svg2
-rw-r--r--_test/test_issues.py4
-rw-r--r--error.py10
-rw-r--r--tokens.py12
7 files changed, 42 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index 24a099b..f0ab62d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,10 +1,9 @@
-[0, 15, 99]: 2019-07-12
- - add `py.typed` to distribution, based on a PR submitted by
- `Michael Crusoe
- <https://bitbucket.org/%7Bc9fbde69-e746-48f5-900d-34992b7860c8%7D/>`__
- - merge PR 40 (also by Michael Crusoe) to more accurately specify
- repository in the README (also reported in a misunderstood issue
- some time ago)
+[0, 15, 100]: 2019-07-17
+ - fixing issue with dumping deep-copied data from commented YAML, by
+ providing both the memo parameter to __deepcopy__, and by allowing
+ startmarks to be compared on their content (reported by `Theofilos
+ Petsios
+ <https://bitbucket.org/%7Be550bc5d-403d-4fda-820b-bebbe71796d3%7D/>`__)
[0, 15, 99]: 2019-07-12
- add `py.typed` to distribution, based on a PR submitted by
diff --git a/README.rst b/README.rst
index bc7c83c..fca85cc 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.99
-:updated: 2019-07-12
+:version: 0.15.100
+:updated: 2019-07-17
:documentation: http://yaml.readthedocs.io
:repository: https://bitbucket.org/ruamel/yaml
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -54,6 +54,13 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key (with empty line)
+0.15.100 (2019-07-17):
+ - fixing issue with dumping deep-copied data from commented YAML, by
+ providing both the memo parameter to __deepcopy__, and by allowing
+ startmarks to be compared on their content (reported by `Theofilos
+ Petsios
+ <https://bitbucket.org/%7Be550bc5d-403d-4fda-820b-bebbe71796d3%7D/>`__)
+
0.15.99 (2019-07-12):
- add `py.typed` to distribution, based on a PR submitted by
`Michael Crusoe
diff --git a/__init__.py b/__init__.py
index 07827ed..48d9a03 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, 99),
- __version__='0.15.99',
+ version_info=(0, 15, 100),
+ __version__='0.15.100',
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 0d4493b..7525ff0 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.99</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.99</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.100</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.100</text></g> </svg>
diff --git a/_test/test_issues.py b/_test/test_issues.py
index 7968e74..90128dd 100644
--- a/_test/test_issues.py
+++ b/_test/test_issues.py
@@ -798,7 +798,7 @@ class TestIssues:
yaml.dump(data, buf)
assert buf.getvalue() == yamldoc
- @pytest.mark.xfail(strict=True, reason='should fail pre 0.15.100', raises=AssertionError)
+ # @pytest.mark.xfail(strict=True, reason='should fail pre 0.15.100', raises=AssertionError)
def test_issue_295(self):
# deepcopy also makes a copy of the start and end mark, and these did not
# have any comparison beyond their ID, which of course changed, breaking
@@ -811,7 +811,7 @@ class TestIssues:
# comment
- l1
- l2
-
+
C:
d: e
f:
diff --git a/error.py b/error.py
index ab1072d..965ff7b 100644
--- a/error.py
+++ b/error.py
@@ -39,6 +39,16 @@ class StreamMark(object):
where = ' in "%s", line %d, column %d' % (self.name, self.line + 1, self.column + 1)
return where
+ def __eq__(self, other):
+ if self.line != other.line or self.column != other.column:
+ return False
+ if self.name != other.name or self.index != other.index:
+ return False
+ return True
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
class FileMark(StreamMark):
__slots__ = ()
diff --git a/tokens.py b/tokens.py
index d476d49..84c6847 100644
--- a/tokens.py
+++ b/tokens.py
@@ -270,3 +270,15 @@ class CommentToken(Token):
except: # NOQA
pass
return 'CommentToken({})'.format(v)
+
+ def __eq__(self, other):
+ if self.start_mark != other.start_mark:
+ return False
+ if self.end_mark != other.end_mark:
+ return False
+ if self.value != other.value:
+ return False
+ return True
+
+ def __ne__(self, other):
+ return not self.__eq__(other)