diff options
author | Anthon van der Neut <anthon@mnt.org> | 2021-08-21 15:06:26 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2021-08-21 15:06:26 +0200 |
commit | 35d4558a7e4d8eae971a2887de8f139849da13b0 (patch) | |
tree | a5e404c7a3575395421a03869199f90b0b553432 /constructor.py | |
parent | d97574a94bca9a6b62511ee14bb633a5fdc2e32e (diff) | |
download | ruamel.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__()
Diffstat (limited to 'constructor.py')
-rw-r--r-- | constructor.py | 5 |
1 files changed, 4 insertions, 1 deletions
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 |