diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-09-26 23:05:03 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-09-26 23:05:03 +0200 |
commit | bce1095295d4a058ed665efde34b22c83b77c8fe (patch) | |
tree | 5d16180f55626eff1038df1e91459b90f816fc80 | |
parent | 946e383b47a227032e92d432c85568caed8065e2 (diff) | |
download | ruamel.yaml-bce1095295d4a058ed665efde34b22c83b77c8fe.tar.gz |
fix issue #238 construct recursive objects0.15.71
*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-- | CHANGES | 8 | ||||
-rw-r--r-- | README.rst | 17 | ||||
-rw-r--r-- | __init__.py | 4 | ||||
-rw-r--r-- | _doc/_static/pypi.svg | 2 | ||||
-rw-r--r-- | _test/test_issues.py | 2 | ||||
-rw-r--r-- | _test/test_z_olddata.py | 41 | ||||
-rw-r--r-- | constructor.py | 12 |
7 files changed, 76 insertions, 10 deletions
@@ -1,3 +1,11 @@ +[0, 15, 71]: 2018-09-26 + - fix regression where handcrafted CommentedMaps could not be initiated (reported by + `Dan Helfman <https://bitbucket.org/dhelfman/>`__) + - fix regression with non-root literal scalars that needed indent indicator + (reported by `Clark Breyman <https://bitbucket.org/clarkbreyman/>`__) + - tag:yaml.org,2002:python/object/apply now also uses __qualname__ on PY3 + (reported by `Douglas RAILLARD <https://bitbucket.org/DouglasRaillard/>`__) + [0, 15, 70]: 2018-09-21 - reverted CommentedMap and CommentedSeq to subclass ordereddict resp. list, reimplemented merge maps so that both ``dict(**commented_map_instance)`` and JSON @@ -4,8 +4,8 @@ ruamel.yaml ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. -:version: 0.15.70 -:updated: 2018-09-21 +:version: 0.15.71 +:updated: 2018-09-26 :documentation: http://yaml.readthedocs.io :repository: https://bitbucket.org/ruamel/ :pypi: https://pypi.org/project/ruamel.yaml/ @@ -54,6 +54,19 @@ ChangeLog .. should insert NEXT: at the beginning of line for next key (with empty line) +0.15.71 (2018-09-26): + - some of the tests now live in YAML files in the + `yaml.data <https://bitbucket.org/ruamel/yaml.data>`__ repository. + ``_test/test_z_data.py`` processes these. + - fix regression where handcrafted CommentedMaps could not be initiated (reported by + `Dan Helfman <https://bitbucket.org/dhelfman/>`__) + - fix regression with non-root literal scalars that needed indent indicator + (reported by `Clark Breyman <https://bitbucket.org/clarkbreyman/>`__) + - tag:yaml.org,2002:python/object/apply now also uses __qualname__ on PY3 + (reported by `Douglas RAILLARD <https://bitbucket.org/DouglasRaillard/>`__) + - issue with self-referring object creation + (reported and fix by `Douglas RAILLARD <https://bitbucket.org/DouglasRaillard/>`__) + 0.15.70 (2018-09-21): - reverted CommentedMap and CommentedSeq to subclass ordereddict resp. list, reimplemented merge maps so that both ``dict(**commented_map_instance)`` and JSON diff --git a/__init__.py b/__init__.py index 6ffb2d4..9b815db 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, 70), - __version__='0.15.70', + version_info=(0, 15, 71), + __version__='0.15.71', 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 8b244c0..b5019c7 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.70</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.70</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.71</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.15.71</text></g> </svg> diff --git a/_test/test_issues.py b/_test/test_issues.py index 5ee5125..fcf1094 100644 --- a/_test/test_issues.py +++ b/_test/test_issues.py @@ -510,9 +510,11 @@ class TestIssues: def test_issue_242(self): from ruamel.yaml.comments import CommentedMap + d0 = CommentedMap([('a', 'b')]) assert d0['a'] == 'b' + # @pytest.mark.xfail(strict=True, reason='bla bla', raises=AssertionError) # def test_issue_xxx(self): # inp = """ diff --git a/_test/test_z_olddata.py b/_test/test_z_olddata.py new file mode 100644 index 0000000..91d89db --- /dev/null +++ b/_test/test_z_olddata.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +from __future__ import print_function + +import sys +import os +import pytest # NOQA + +sys.path.insert(0, os.path.dirname(__file__) + '/lib') + +import warnings # NOQA + + +args = [] + + +def test_data(): + import test_appliance # NOQA + + collections = [] + import test_yaml + + collections.append(test_yaml) + test_appliance.run(collections, args) + + +# @pytest.mark.skipif(not ruamel.yaml.__with_libyaml__, +# reason="no libyaml") + + +def test_data_ext(): + collections = [] + import ruamel.yaml # NOQA + import test_appliance # NOQA + + warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning) + if ruamel.yaml.__with_libyaml__: + import test_yaml_ext + + collections.append(test_yaml_ext) + test_appliance.run(collections, args) diff --git a/constructor.py b/constructor.py index 6448067..245e9f7 100644 --- a/constructor.py +++ b/constructor.py @@ -133,9 +133,10 @@ class BaseConstructor(object): old_deep = self.deep_construct self.deep_construct = True if node in self.recursive_objects: - raise ConstructorError( - None, None, 'found unconstructable recursive node', node.start_mark - ) + return self.recursive_objects[node] + # raise ConstructorError( + # None, None, 'found unconstructable recursive node', node.start_mark + # ) self.recursive_objects[node] = None constructor = None # type: Any tag_suffix = None @@ -914,9 +915,10 @@ class Constructor(SafeConstructor): # Format: # !!python/object:module.name { ... state ... } instance = self.make_python_instance(suffix, node, newobj=True) + self.recursive_objects[node] = instance yield instance - # deep = hasattr(instance, '__setstate__') - state = self.construct_mapping(node, deep=False) + deep = hasattr(instance, '__setstate__') + state = self.construct_mapping(node, deep=deep) self.set_python_instance_state(instance, state) def construct_python_object_apply(self, suffix, node, newobj=False): |