Skip to content

[3.9] bpo-45520: Backport __getstate__, __setstate__ methods for dataclasses from 3.10 into 3.9 (GH-25786)#29147

Closed
sobolevn wants to merge 2 commits into
python:3.9from
sobolevn:issue-45520
Closed

[3.9] bpo-45520: Backport __getstate__, __setstate__ methods for dataclasses from 3.10 into 3.9 (GH-25786)#29147
sobolevn wants to merge 2 commits into
python:3.9from
sobolevn:issue-45520

Conversation

@sobolevn

@sobolevn sobolevn commented Oct 22, 2021

Copy link
Copy Markdown
Member

@sobolevn sobolevn changed the title Backport __getstate__, __setstate__ methods from 3.10 into 3.9 [3.9] bpo-45520: Backport __getstate__, __setstate__ methods from 3.10 into 3.9 (GH-25786) Oct 22, 2021
@sobolevn sobolevn closed this Oct 22, 2021
@sobolevn sobolevn reopened this Oct 22, 2021
@sobolevn

sobolevn commented Oct 22, 2021

Copy link
Copy Markdown
Member Author

I'll toggle this PR once again after all other tests pass, because Azure seems to be broken for some unrelated reason.

@sobolevn

Copy link
Copy Markdown
Member Author

It now passes!

I've also created https://bugs.python.org/issue45566 to sync the pickle protocols thing with more recent versions.

miss-islington pushed a commit that referenced this pull request Oct 24, 2021
Refs #29147

Automerge-Triggered-By: GH:ericvsmith
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 24, 2021
…GH-29150)

Refs python#29147

Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit 07236d5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
miss-islington added a commit that referenced this pull request Oct 24, 2021
Refs #29147

Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit 07236d5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@sobolevn

Copy link
Copy Markdown
Member Author

Friendly ping @ericvsmith 🙂

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Nov 29, 2021
@sobolevn

Copy link
Copy Markdown
Member Author

CC @ericvsmith @Fidget-Spinner

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Nov 30, 2021
@merwok

merwok commented Jan 2, 2022

Copy link
Copy Markdown
Member

Please mention dataclasses in the PR title

@sobolevn sobolevn changed the title [3.9] bpo-45520: Backport __getstate__, __setstate__ methods from 3.10 into 3.9 (GH-25786) [3.9] bpo-45520: Backport __getstate__, __setstate__ methods for dataclasses from 3.10 into 3.9 (GH-25786) Jan 2, 2022
@Fidget-Spinner

Copy link
Copy Markdown
Member

@sobolevn sorry for the really long delay (I dropped the ball on this notification for a month). Unfortunately I have to admit I'm clueless at pickle so I can't review this.

@sobolevn

sobolevn commented Jan 12, 2022

Copy link
Copy Markdown
Member Author

@Fidget-Spinner no worries, thanks for your work!

This is a backport of a bugfix from 3.10 to 3.9
For some reason it was not done in #25786

CC @JelleZijlstra as the original reviewer 🙂

@JelleZijlstra

Copy link
Copy Markdown
Member

Since dataclasses only gained native slot support in 3.10, it doesn't seem important to apply this fix to 3.9. (It affects people who set __slots__ manually, but if you do that it doesn't seem too bad to also manually provide pickle support.) Also, unconditionally setting these methods is risky; it may overwrite a user-provided method.

I'll leave the decision to @ericvsmith though.

@MaxwellDupre MaxwellDupre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran 175 tests in 1.202s
OK
Looks reasonable.

@ambv

ambv commented May 16, 2022

Copy link
Copy Markdown
Contributor

We're releasing the last bugfix release of 3.9 today and this PR's been stale for a while. Sadly it's a wontfix now.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants