summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-08-21 15:06:26 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-08-21 15:06:26 +0200
commit35d4558a7e4d8eae971a2887de8f139849da13b0 (patch)
treea5e404c7a3575395421a03869199f90b0b553432
parentd97574a94bca9a6b62511ee14bb633a5fdc2e32e (diff)
downloadruamel.yaml-35d4558a7e4d8eae971a2887de8f139849da13b0.tar.gz
fix for 3940.17.12
when the newly created object has the signature __attrs_attrs__ attribute initialisation is not done using update by by calling __init__()
-rw-r--r--CHANGES4
-rw-r--r--README.rst8
-rw-r--r--__init__.py4
-rw-r--r--_doc/_static/pypi.svg2
-rw-r--r--constructor.py5
5 files changed, 17 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index ee17046..2383909 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+[0, 17, 12]: 2021-08-21
+ - fix issue with anchor on registered class not preserved and those classes using package
+ attrs with `@attr.s()` (both reported by `ssph <https://sourceforge.net/u/sph/>`__)
+
[0, 17, 11]: 2021-08-19
- fix error baseclass for ``DuplicateKeyErorr`` (reported by `Łukasz Rogalski
<https://sourceforge.net/u/lrogalski/>`__)
diff --git a/README.rst b/README.rst
index 16abf3d..a3b9dbf 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.17.11
-:updated: 2021-08-19
+:version: 0.17.12
+:updated: 2021-08-21
:documentation: http://yaml.readthedocs.io
:repository: https://sourceforge.net/projects/ruamel-yaml/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -72,6 +72,10 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key (with empty line)
+0.17.12 (2021-08-21):
+ - fix issue with anchor on registered class not preserved and those classes using package
+ attrs with `@attr.s()` (both reported by `ssph <https://sourceforge.net/u/sph/>`__)
+
0.17.11 (2021-08-19):
- fix error baseclass for ``DuplicateKeyErorr`` (reported by `Łukasz Rogalski
<https://sourceforge.net/u/lrogalski/>`__)
diff --git a/__init__.py b/__init__.py
index 4ecaef9..cbee327 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, 11),
- __version__='0.17.11',
+ version_info=(0, 17, 12),
+ __version__='0.17.12',
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 3364900..f0abbb9 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.11</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.17.11</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.12</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.17.12</text></g> </svg>
diff --git a/constructor.py b/constructor.py
index 3cc76a3..1673479 100644
--- a/constructor.py
+++ b/constructor.py
@@ -1635,7 +1635,10 @@ class RoundTripConstructor(SafeConstructor):
data.__setstate__(state)
else:
state = SafeConstructor.construct_mapping(self, node)
- data.__dict__.update(state)
+ if hasattr(data, '__attrs_attrs__'): # issue 394
+ cls.__init__(cls, **state)
+ else:
+ data.__dict__.update(state)
if node.anchor:
from ruamel.yaml.serializer import templated_id
from ruamel.yaml.anchor import Anchor