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 eric.smith
Recipients eric.smith
Date 2021-05-01.16:03:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619885018.94.0.115449567872.issue43999@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-05-01 16:03:38eric.smithsetrecipients: + eric.smith
2021-05-01 16:03:38eric.smithsetmessageid: <1619885018.94.0.115449567872.issue43999@roundup.psfhosted.org>
2021-05-01 16:03:38eric.smithlinkissue43999 messages
2021-05-01 16:03:38eric.smithcreate