Skip to content

Commit 9ca6d12

Browse files
author
thomas.wouters
committed
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.) git-svn-id: http://svn.python.org/projects/python/trunk@51565 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent e4babb0 commit 9ca6d12

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

Lib/test/test_array.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ def test_copy(self):
8585
self.assertNotEqual(id(a), id(b))
8686
self.assertEqual(a, b)
8787

88+
def test_deepcopy(self):
89+
import copy
90+
a = array.array(self.typecode, self.example)
91+
b = copy.deepcopy(a)
92+
self.assertNotEqual(id(a), id(b))
93+
self.assertEqual(a, b)
94+
8895
def test_pickle(self):
8996
for protocol in (0, 1, 2):
9097
a = array.array(self.typecode, self.example)

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ Dag Gruneau
242242
Michael Guravage
243243
Lars Gust�bel
244244
Barry Haddow
245+
V�clav Haisman
245246
Paul ten Hagen
246247
Rasmus Hahn
247248
Peter Haight

Modules/arraymodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ PyMethodDef array_methods[] = {
14951495
copy_doc},
14961496
{"count", (PyCFunction)array_count, METH_O,
14971497
count_doc},
1498-
{"__deepcopy__",(PyCFunction)array_copy, METH_NOARGS,
1498+
{"__deepcopy__",(PyCFunction)array_copy, METH_O,
14991499
copy_doc},
15001500
{"extend", (PyCFunction)array_extend, METH_O,
15011501
extend_doc},

0 commit comments

Comments
 (0)