bpo-44676: Serialize the union type using only public API (GH-27323)

Remove also the _from_args() constructor.
This commit is contained in:
Serhiy Storchaka 2021-07-24 21:26:02 +03:00 committed by GitHub
parent 4f5980a4f5
commit 435a0334d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 79 deletions

View file

@ -36,6 +36,12 @@ else:
pickle(complex, pickle_complex, complex)
def pickle_union(obj):
import functools, operator
return functools.reduce, (operator.or_, obj.__args__)
pickle(type(int | str), pickle_union)
# Support for pickling new-style objects
def _reconstructor(cls, base, state):