]> granicus.if.org Git - python/commitdiff
Somehow, copy() of a classic class object was handled
authorGuido van Rossum <guido@python.org>
Fri, 7 Feb 2003 17:53:23 +0000 (17:53 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 7 Feb 2003 17:53:23 +0000 (17:53 +0000)
atomically, but deepcopy() didn't support this at all.
I don't see any reason for this, so I'm adding ClassType
to the set of types that are deep-copied atomically.

Lib/copy.py
Lib/test/test_copy.py

index c1c0ec0cbdc7afdd683b6a8ee2e356572b82ceb9..b57fa89710ae4b5804c6488c6f26a30c2dad079a 100644 (file)
@@ -220,6 +220,7 @@ except AttributeError:
     pass
 d[types.TypeType] = _deepcopy_atomic
 d[types.XRangeType] = _deepcopy_atomic
+d[types.ClassType] = _deepcopy_atomic
 
 def _deepcopy_list(x, memo):
     y = []
index 35ce46a5232813f3fef4f6869d6100dbe9f3c0d1..6a31f75f65124c11e56acd809bf9a9548a94831e 100644 (file)
@@ -239,7 +239,7 @@ class TestCopy(unittest.TestCase):
             pass
         tests = [None, 42, 2L**100, 3.14, True, False, 1j,
                  "hello", u"hello\u1234", f.func_code,
-                 NewStyle, xrange(10)]
+                 NewStyle, xrange(10), Classic]
         for x in tests:
             self.assert_(copy.deepcopy(x) is x, `x`)