[Python-checkins] r51565 - in python/trunk: Lib/test/test_array.py Misc/ACKS Modules/arraymodule.c

thomas.wouters python-checkins at python.org
Thu Aug 24 20:40:21 CEST 2006


Author: thomas.wouters
Date: Thu Aug 24 20:40:20 2006
New Revision: 51565

Modified:
   python/trunk/Lib/test/test_array.py
   python/trunk/Misc/ACKS
   python/trunk/Modules/arraymodule.c
Log:

Fix SF bug #1545837: array.array borks on deepcopy.
array.__deepcopy__() needs to take an argument, even if it doesn't actually
use it. Will backport to 2.5 and 2.4 (if applicable.)



Modified: python/trunk/Lib/test/test_array.py
==============================================================================
--- python/trunk/Lib/test/test_array.py	(original)
+++ python/trunk/Lib/test/test_array.py	Thu Aug 24 20:40:20 2006
@@ -85,6 +85,13 @@
         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)

Modified: python/trunk/Misc/ACKS
==============================================================================
--- python/trunk/Misc/ACKS	(original)
+++ python/trunk/Misc/ACKS	Thu Aug 24 20:40:20 2006
@@ -242,6 +242,7 @@
 Michael Guravage
 Lars Gustäbel
 Barry Haddow
+Václav Haisman
 Paul ten Hagen
 Rasmus Hahn
 Peter Haight

Modified: python/trunk/Modules/arraymodule.c
==============================================================================
--- python/trunk/Modules/arraymodule.c	(original)
+++ python/trunk/Modules/arraymodule.c	Thu Aug 24 20:40:20 2006
@@ -1495,7 +1495,7 @@
 	 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},


More information about the Python-checkins mailing list