Skip to content

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

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

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
Member

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
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

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

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):
Copy link
Member

Choose a reason for hiding this comment

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

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
Member

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

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 merged commit 435a033 into python:main Jul 24, 2021
@serhiy-storchaka serhiy-storchaka deleted the union-pickle branch July 24, 2021 18:26
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.10 only security fixes label Jul 24, 2021
@miss-islington
Copy link
Contributor

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

@bedevere-bot
Copy link

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

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jul 24, 2021
miss-islington pushed 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
Labels
skip news type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants