Skip to content

gh-104035: Do not ignore user-defined __{get,set}state__ in slotted frozen dataclasses#104041

Merged
carljm merged 2 commits intopython:mainfrom
sobolevn:issue-104035
May 1, 2023
Merged

gh-104035: Do not ignore user-defined __{get,set}state__ in slotted frozen dataclasses#104041
carljm merged 2 commits intopython:mainfrom
sobolevn:issue-104035

Conversation

@sobolevn
Copy link
Member

@sobolevn sobolevn commented May 1, 2023

I had some time to look at this problem. Here's what I found:

  1. Our docs do not say anything about __getstate__ or __setstate__ methods and their generation: https://docs.python.org/3/library/dataclasses.html
  2. I think that this new implementation is in-line with other methods / attributes generation
  3. It should not break any existing code, except cases where some invalid __getstate__ / __setstate__ method was overridden with the correct one (but, there's nothing we can do if user already has invalid code)
  4. This seems like a bug-fix, so probably it should be back-ported to 3.11 as well

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants