mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-44676: Serialize the union type using only public API (GH-27323)
Remove also the _from_args() constructor.
This commit is contained in:
parent
4f5980a4f5
commit
435a0334d3
4 changed files with 22 additions and 79 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue