You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dataclasses: frozen dataclasses with slots' __setattr__ and __delattr__ does not work. #105936
The check in frozen dataclasses' __setattr__ and __delattr__ does not work when slots=True:
@dataclass(frozen=True, slots=True)
class C:
i: int
C(10).j = 5
crashes with
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
instead of raising a FrozenInstanceError.
Likewise,
@dataclass(frozen=True, slots=True)
class C:
i: int
class D(C):
pass
D(10).j = 5
A 3.13 is up as a Draft PR because it requires more changes and backporting pieces of some other stuff that is already in 3.14 in order for it to work.
Activity
gh-105936: Properly update closure cells for `__setattr__` and `__del…
pythongh-105936: Properly update closure cells for `__setattr__` and …
pythongh-105936: Properly update closure cells for `__setattr__` and …
[3.14] gh-105936: Properly update closure cells for `__setattr__` and…
[3.13] pythongh-105936: Properly update closure cells for `__setattr_…
gpshead commentedon Apr 13, 2026
A 3.13 is up as a Draft PR because it requires more changes and backporting pieces of some other stuff that is already in 3.14 in order for it to work.
Revert "pythongh-105936: Properly update closure cells for `__setattr…
pythongh-105936: Properly update closure cells for `__setattr__` and …
[3.13] gh-105936: Properly update closure cells for __setattr__ and _…
gpshead commentedon Apr 26, 2026
all merged. thanks for the report, contributions and reviews.