mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fix for SF bug ##497426: can't deepcopy recursive new objects
deepcopy(), _reconstruct(): pass the memo to the other function, so that recursive data structures built out of new-style objects may be deeply copied correctly. 2.2.1 bugfix!
This commit is contained in:
parent
1e91c1444a
commit
2764a3a50e
1 changed files with 10 additions and 1 deletions
|
@ -2702,7 +2702,15 @@ def strops():
|
|||
vereq('%c' % 5, '\x05')
|
||||
vereq('%c' % '5', '5')
|
||||
|
||||
|
||||
def deepcopyrecursive():
|
||||
if verbose: print "Testing deepcopy of recursive objects..."
|
||||
class Node:
|
||||
pass
|
||||
a = Node()
|
||||
b = Node()
|
||||
a.b = b
|
||||
b.a = a
|
||||
z = deepcopy(a) # This blew up before
|
||||
|
||||
|
||||
def test_main():
|
||||
|
@ -2759,6 +2767,7 @@ def test_main():
|
|||
delhook()
|
||||
hashinherit()
|
||||
strops()
|
||||
deepcopyrecursive()
|
||||
if verbose: print "All OK"
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue