]> granicus.if.org Git - python/commitdiff
Backport trunk checkin r51565:
authorThomas Wouters <thomas@python.org>
Fri, 29 Dec 2006 14:42:17 +0000 (14:42 +0000)
committerThomas Wouters <thomas@python.org>
Fri, 29 Dec 2006 14:42:17 +0000 (14:42 +0000)
Fix SF bug #1545837: array.array borks on deepcopy. array.__deepcopy__()
needs to take an argument, even if it doesn't actually use it.

Lib/test/test_array.py
Misc/ACKS
Modules/arraymodule.c

index 62361fce8c69149ccbf2a91fe4266579b0c70a69..06f13cd2b7f3648d8a2ea9388a35e273abb580ba 100755 (executable)
@@ -85,6 +85,13 @@ class BaseTest(unittest.TestCase):
         self.assertNotEqual(id(a), id(b))
         self.assertEqual(a, b)
 
+    def test_deepcopy(self):
+        import copy
+        a = array.array(self.typecode, self.example)
+        b = copy.deepcopy(a)
+        self.assertNotEqual(id(a), id(b))
+        self.assertEqual(a, b)
+
     def test_pickle(self):
         for protocol in (0, 1, 2):
             a = array.array(self.typecode, self.example)
index 2efbd059e6413d48c84dd7415162224931d638f6..7524baefc2df57b1c8cc74b8b9a3b3839490ea7d 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -242,6 +242,7 @@ Dag Gruneau
 Michael Guravage
 Lars Gustäbel
 Barry Haddow
+Václav Haisman
 Paul ten Hagen
 Rasmus Hahn
 Peter Haight
index efa7835c375d4f10b60d9ce27aca909bf0ca3b82..9de14fd060d29a648efaa05ec3612983966cde99 100644 (file)
@@ -1495,7 +1495,7 @@ PyMethodDef array_methods[] = {
         copy_doc},
        {"count",       (PyCFunction)array_count,       METH_O,
         count_doc},
-       {"__deepcopy__",(PyCFunction)array_copy,        METH_NOARGS,
+       {"__deepcopy__",(PyCFunction)array_copy,        METH_O,
         copy_doc},
        {"extend",      (PyCFunction)array_extend,      METH_O,
         extend_doc},