mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-90494: Reject 6th element of the __reduce__() tuple (GH-93609)
copy.copy() and copy.deepcopy() now always raise a TypeError if __reduce__() returns a tuple with length 6 instead of silently ignore the 6th item or produce incorrect result.
This commit is contained in:
parent
cffa4f7854
commit
a365dd64c2
4 changed files with 27 additions and 2 deletions
|
@ -258,7 +258,7 @@ def _keep_alive(x, memo):
|
|||
|
||||
def _reconstruct(x, memo, func, args,
|
||||
state=None, listiter=None, dictiter=None,
|
||||
deepcopy=deepcopy):
|
||||
*, deepcopy=deepcopy):
|
||||
deep = memo is not None
|
||||
if deep and args:
|
||||
args = (deepcopy(arg, memo) for arg in args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue