]> granicus.if.org Git - python/commitdiff
Copy builtin functions as atomic. Fixes #746304. Will backport to 2.2.
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 14 Jun 2003 07:10:06 +0000 (07:10 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 14 Jun 2003 07:10:06 +0000 (07:10 +0000)
Lib/copy.py
Lib/test/test_copy.py
Misc/NEWS

index 02aa46b50331911515632a2ded31ec8d56881497..31adfd331723afc8a18a0096d6fb53e21092f9f4 100644 (file)
@@ -120,6 +120,7 @@ except AttributeError:
 d[types.TypeType] = _copy_atomic
 d[types.XRangeType] = _copy_atomic
 d[types.ClassType] = _copy_atomic
+d[types.BuiltinFunctionType] = _copy_atomic
 
 def _copy_list(x):
     return x[:]
@@ -233,6 +234,7 @@ except AttributeError:
 d[types.TypeType] = _deepcopy_atomic
 d[types.XRangeType] = _deepcopy_atomic
 d[types.ClassType] = _deepcopy_atomic
+d[types.BuiltinFunctionType] = _deepcopy_atomic
 
 def _deepcopy_list(x, memo):
     y = []
index a53f988292746808bc9cde72de7dac5a44338256..3d44304db9cd57776dff2ac692c414e862c521ba 100644 (file)
@@ -84,7 +84,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), Classic]
+                 NewStyle, xrange(10), Classic, max]
         for x in tests:
             self.assert_(copy.copy(x) is x, `x`)
 
@@ -257,7 +257,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), Classic]
+                 NewStyle, xrange(10), Classic, max]
         for x in tests:
             self.assert_(copy.deepcopy(x) is x, `x`)
 
index d4a80582179ff162ebd34c73c8449eec39e1fdbd..07a5b57c2ddcf75fe7947610b5674ab52e52dda9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -83,6 +83,7 @@ Library
 - copy.py: applied SF patch 707900, fixing bug 702858, by Steven
   Taschuk.  Copying a new-style class that had a reference to itself
   didn't work.  (The same thing worked fine for old-style classes.)
+  Builtin functions are now treated as atomic, fixing bug #746304.
 
 - difflib.py has two new functions:  context_diff() and unified_diff().