mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
Issue #20289: The copy module now uses pickle protocol 4 (PEP 3154) and
supports copying of instances of classes whose __new__ method takes keyword-only arguments.
This commit is contained in:
parent
944fbcc478
commit
32af7549a7
3 changed files with 76 additions and 2 deletions
|
@ -94,7 +94,7 @@ def copy(x):
|
|||
else:
|
||||
reductor = getattr(x, "__reduce_ex__", None)
|
||||
if reductor:
|
||||
rv = reductor(2)
|
||||
rv = reductor(4)
|
||||
else:
|
||||
reductor = getattr(x, "__reduce__", None)
|
||||
if reductor:
|
||||
|
@ -171,7 +171,7 @@ def deepcopy(x, memo=None, _nil=[]):
|
|||
else:
|
||||
reductor = getattr(x, "__reduce_ex__", None)
|
||||
if reductor:
|
||||
rv = reductor(2)
|
||||
rv = reductor(4)
|
||||
else:
|
||||
reductor = getattr(x, "__reduce__", None)
|
||||
if reductor:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue