From ba8522ad28a444e89ccfe6d6fe1e57824fc94a96 Mon Sep 17 00:00:00 2001 From: Thomas Wouters Date: Thu, 24 Aug 2006 18:55:01 +0000 Subject: [PATCH] Backport trunk's revision 51565: 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.) --- Lib/test/test_array.py | 7 +++++++ Misc/ACKS | 1 + Modules/arraymodule.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index b15298fbfedc..3bf52f00261d 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -81,6 +81,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_insert(self): a = array.array(self.typecode, self.example) a.insert(0, self.example[0]) diff --git a/Misc/ACKS b/Misc/ACKS index 8806c801afd5..00ee420a6d54 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -227,6 +227,7 @@ Dag Gruneau Michael Guravage Lars Gustäbel Barry Haddow +Václav Haisman Paul ten Hagen Rasmus Hahn Peter Haight diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index f8c4918003e3..469c5cbcf20e 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1468,7 +1468,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}, -- 2.47.3