This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author trey
Recipients trey
Date 2021-11-25.01:53:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637805231.22.0.691568548115.issue45897@roundup.psfhosted.org>
In-reply-to
Content
When making a dataclass with slots=True and frozen=True, assigning to an invalid attribute raises a TypeError rather than a FrozenInstanceError:

>>> from dataclasses import dataclass
>>> @dataclass(frozen=True, slots=True)
... class Vector:
...     x: float
...     y: float
...     z: float
...
>>> v = Vector(1, 2, 3)
>>> v.a = 4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 5, in __setattr__
TypeError: super(type, obj): obj must be an instance or subtype of type
History
Date User Action Args
2021-11-25 01:53:51treysetrecipients: + trey
2021-11-25 01:53:51treysetmessageid: <1637805231.22.0.691568548115.issue45897@roundup.psfhosted.org>
2021-11-25 01:53:51treylinkissue45897 messages
2021-11-25 01:53:51treycreate