Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-44676: Serialize the union type using only public API #27323

Merged
merged 4 commits into from Jul 24, 2021

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jul 24, 2021

@uriyyo
Copy link
Contributor

@uriyyo uriyyo commented Jul 24, 2021

Should we also remove Union._from_args classmethod introduced by #27244? Basically, it was introduced for pickling support so looks like we don't need it anymore.

Copy link
Contributor

@Fidget-Spinner Fidget-Spinner left a comment

Should we also remove Union._from_args classmethod introduced by #27244? Basically, it was introduced for pickling support so looks like we don't need it anymore.

Agreed. Lets remove it.

Note: we can only remove it if we're backporting this to 3.10. Pickle docs says its confirmed to be backwards compatible. So if we don't backport this, we have to leave the private method in forever :(. Either that, or we can remove serialization from 3.10, I created a PR at GH-27335 for that.

If Serhiy agrees to backporting this, we should probably consult the RM Pablo again.

@@ -36,6 +36,12 @@ def pickle_complex(c):

pickle(complex, pickle_complex, complex)

def pickle_union(obj):

This comment has been minimized.

@Fidget-Spinner

Fidget-Spinner Jul 24, 2021
Contributor

Off topic: I didn't know such a module existed 😮 . This is really cool! Thanks for teaching me something new today Serhiy.

@Fidget-Spinner
Copy link
Contributor

@Fidget-Spinner Fidget-Spinner commented Jul 24, 2021

Copied over from GH-27244, by Yurii:

@Fidget-Spinner I just realise that Union._from_args will be removed by #27323. I think we should backport #27323 to not introduce Union._from_args at python 3.10.

I agree with Yurii's reasoning here. +1 to backport this to 3.10 to remove _from_args from the API.

Alternatively, we can remove the ability to pickle Union in 3.10 (see GH-27333).

@serhiy-storchaka
Copy link
Member Author

@serhiy-storchaka serhiy-storchaka commented Jul 24, 2021

Oh, I did not know this feature was backported to 3.10. It makes sense to haste and backport this PR too.

@serhiy-storchaka serhiy-storchaka requested a review from gvanrossum as a code owner Jul 24, 2021
@serhiy-storchaka serhiy-storchaka merged commit 435a033 into python:main Jul 24, 2021
12 checks passed
12 checks passed
@github-actions
Check for source changes
Details
@github-actions
Check if generated files are up to date
Details
@github-actions
Windows (x86)
Details
@github-actions
Windows (x64)
Details
@github-actions
macOS
Details
@github-actions
Ubuntu
Details
@github-actions
Ubuntu SSL tests with OpenSSL
Details
@github-actions
Address sanitizer Address sanitizer
Details
Azure Pipelines PR #20210724.32 succeeded
Details
@travis-ci
Travis CI - Pull Request Build Passed
Details
@bedevere-bot
bedevere/issue-number Issue number 44676 found
Details
@bedevere-bot
bedevere/news "skip news" label found
@serhiy-storchaka serhiy-storchaka deleted the serhiy-storchaka:union-pickle branch Jul 24, 2021
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 24, 2021

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒🤖

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jul 24, 2021

GH-27340 is a backport of this pull request to the 3.10 branch.

miss-islington added a commit to miss-islington/cpython that referenced this pull request Jul 24, 2021
…7323)

Remove also the _from_args() constructor.
(cherry picked from commit 435a033)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Jul 24, 2021
…H-27340)

Remove also the _from_args() constructor.
(cherry picked from commit 435a033)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants