Message392603
Originally reported in https://github.com/ericvsmith/dataclasses/issues/154
import pickle
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class ExampleDataclass:
foo: str
bar: int
assert ExampleDataclass.__slots__ == ("foo", "bar")
assert pickle.loads(
pickle.dumps(ExampleDataclass("a", 1))
) == ExampleDataclass("a", 1)
File "<string>", line 4, in __setattr__
dataclasses.FrozenInstanceError: cannot assign to field 'foo'
I'll get a PR ready, likely based on ariebovenberg's solution in the above mentioned issue. |
|
Date |
User |
Action |
Args |
2021-05-01 16:03:38 | eric.smith | set | recipients:
+ eric.smith |
2021-05-01 16:03:38 | eric.smith | set | messageid: <1619885018.94.0.115449567872.issue43999@roundup.psfhosted.org> |
2021-05-01 16:03:38 | eric.smith | link | issue43999 messages |
2021-05-01 16:03:38 | eric.smith | create | |
|