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 jfuruness
Recipients jfuruness
Date 2021-10-18.23:18:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634599102.35.0.694436062352.issue45520@roundup.psfhosted.org>
In-reply-to
Content
If you define a frozen dataclass with slots and deep copy it, an error will occur. If you run the same code and remove the slots, the error will not occur. I assume this behavior is not intentional? Apologies if I'm submitting this wrong, this is the first time I've submitted an issue here so I'm not quite sure how to do it properly.

Example below:

```
from dataclasses import dataclass
from copy import deepcopy

@dataclass(frozen=True)
class FrozenData:
    # Without slots no errors occur?
    __slots__ = "my_string",

    my_string: str

deepcopy(FrozenData(my_string="initial"))
```

Error that occurs:
```
dataclasses.FrozenInstanceError: cannot assign to field 'my_string'
```
History
Date User Action Args
2021-10-18 23:18:22jfurunesssetrecipients: + jfuruness
2021-10-18 23:18:22jfurunesssetmessageid: <1634599102.35.0.694436062352.issue45520@roundup.psfhosted.org>
2021-10-18 23:18:22jfurunesslinkissue45520 messages
2021-10-18 23:18:22jfurunesscreate