From: Thomas Wouters Date: Fri, 29 Dec 2006 14:42:17 +0000 (+0000) Subject: Backport trunk checkin r51565: X-Git-Tag: v2.5.1c1~196 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04e820443b78edebc986212e74291daba2480a12;p=python Backport trunk checkin r51565: Fix SF bug #1545837: array.array borks on deepcopy. array.__deepcopy__() needs to take an argument, even if it doesn't actually use it. --- diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 62361fce8c..06f13cd2b7 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -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) diff --git a/Misc/ACKS b/Misc/ACKS index 2efbd059e6..7524baefc2 100644 --- 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 diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index efa7835c37..9de14fd060 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -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},