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
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
Bug report
The check in frozen dataclasses'
__setattr__and__delattr__does not work whenslots=True:crashes with
instead of raising a FrozenInstanceError.
Likewise,
crashes with the same error instead of working.
Linked PRs
__setattr__and__delattr_#105937__setattr__and__delattr__in frozen dataclasses with slots #144021__setattr__and__delattr__in frozen dataclasses with slots (GH-144021) #148469