summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-04-07 21:49:28 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-04-07 21:49:28 +0200
commitfc9c33962bc4f91dd2c46e002cc8a433d05b2f88 (patch)
tree17193a692c890694dddc3554645e8351ecb920a9
parent615e8c5a2e24eb5ffa0ff623cd616d88ca430e50 (diff)
downloadruamel.yaml-fc9c33962bc4f91dd2c46e002cc8a433d05b2f88.tar.gz
partial fix for 3510.17.4
-rw-r--r--CHANGES5
-rw-r--r--README.rst7
-rw-r--r--__init__.py4
-rw-r--r--_doc/_static/pypi.svg2
-rw-r--r--representer.py4
5 files changed, 17 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index 46a0aea..ff47c47 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+[0, 17, 4]: 2021-04-07
+ - prevent (empty) comments from throwing assertion error (issue 351
+ reported by `William Kimball <https://sourceforge.net/u/william303/>`__)
+ comments (or empty line) will be dropped
+
[0, 17, 3]: 2021-04-07
- fix for issue 382 caused by an error in a format string (reported by
`William Kimball <https://sourceforge.net/u/william303/>`__)
diff --git a/README.rst b/README.rst
index 7063d9b..cdf3498 100644
--- a/README.rst
+++ b/README.rst
@@ -4,7 +4,7 @@ ruamel.yaml
``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python.
-:version: 0.17.3
+:version: 0.17.4
:updated: 2021-04-07
:documentation: http://yaml.readthedocs.io
:repository: https://sourceforge.net/projects/ruamel-yaml/
@@ -65,6 +65,11 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key (with empty line)
+0.17.4 (2021-04-07):
+ - prevent (empty) comments from throwing assertion error (issue 351
+ reported by `William Kimball <https://sourceforge.net/u/william303/>`__)
+ comments (or empty line) will be dropped
+
0.17.3 (2021-04-07):
- fix for issue 382 caused by an error in a format string (reported by
`William Kimball <https://sourceforge.net/u/william303/>`__)
diff --git a/__init__.py b/__init__.py
index 1c22d65..ee2b544 100644
--- a/__init__.py
+++ b/__init__.py
@@ -5,8 +5,8 @@ if False: # MYPY
_package_data = dict(
full_package_name='ruamel.yaml',
- version_info=(0, 17, 3),
- __version__='0.17.3',
+ version_info=(0, 17, 4),
+ __version__='0.17.4',
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 07a1442..d88372e 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.17.3</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.17.3</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.17.4</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.17.4</text></g> </svg>
diff --git a/representer.py b/representer.py
index d82cc3e..32e6f58 100644
--- a/representer.py
+++ b/representer.py
@@ -863,7 +863,9 @@ class RoundTripRepresenter(SafeRepresenter):
node_value = self.represent_data(item_value)
item_comment = item_comments.get(item_key)
if item_comment:
- assert getattr(node_key, 'comment', None) is None
+ # assert getattr(node_key, 'comment', None) is None
+ # issue 351 did throw this because the comment from the list item was
+ # moved to the dict
node_key.comment = item_comment[:2]
nvc = getattr(node_value, 'comment', None)
if nvc is not None: # end comment already there