From: Guido van Rossum Date: Fri, 28 Dec 2001 21:39:03 +0000 (+0000) Subject: Fix for SF bug ##497426: can't deepcopy recursive new objects X-Git-Tag: v2.3c1~6933 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2764a3a50ebb467690d77f8925a3414d71756311;p=thirdparty%2FPython%2Fcpython.git 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! --- diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index ea987f223c71..dd95ddeb91e2 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -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__":