[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-22 Thread Nikita Sobolev
Change by Nikita Sobolev : -- keywords: +patch nosy: +sobolevn nosy_count: 3.0 -> 4.0 pull_requests: +27423 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29147 ___ Python tracker

[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-20 Thread Justin Furuness
Justin Furuness added the comment: Thank you for the in-depth explanation. That all makes sense to me, I have run into the __slots__ with defaults issues before, I'll be sure to try out these fixes. I appreciate you taking the time. Thanks, Justin On Tue, Oct 19, 2021 at 5:28 PM Josh

[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: You're right that in non-dataclass scenarios, you'd just use __slots__. The slots=True thing was necessary for any case where any of the dataclass's attributes have default values (my_int: int = 0), or are defined with fields (my_list: list =

[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-19 Thread Justin Furuness
Justin Furuness added the comment: I didn't realize it was possible to add slots in that way (slots=True). I think for normal classes manually defining __slots__ is the common way of adding __slots__ (at least for me), so it feels weird to me that manually defining __slots__ instead of adding

[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: When I define this with the new-in-3.10 slots=True argument to dataclass rather than manually defining __slots__ it works just fine. Looks like the pickle format changes rather dramatically to accommodate it. >>> @dataclass(frozen=True, slots=True) ...

[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-18 Thread Filipe Laíns
Change by Filipe Laíns : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45520] Frozen dataclass deep copy doesn't work with __slots__

2021-10-18 Thread Christina Gorbenko
New submission from Christina Gorbenko : 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