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.
This commit is contained in:
parent
e38ecee5c3
commit
04e820443b
|
@ -85,6 +85,13 @@ class BaseTest(unittest.TestCase):
|
||||||
self.assertNotEqual(id(a), id(b))
|
self.assertNotEqual(id(a), id(b))
|
||||||
self.assertEqual(a, 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):
|
def test_pickle(self):
|
||||||
for protocol in (0, 1, 2):
|
for protocol in (0, 1, 2):
|
||||||
a = array.array(self.typecode, self.example)
|
a = array.array(self.typecode, self.example)
|
||||||
|
|
|
@ -242,6 +242,7 @@ Dag Gruneau
|
||||||
Michael Guravage
|
Michael Guravage
|
||||||
Lars Gustäbel
|
Lars Gustäbel
|
||||||
Barry Haddow
|
Barry Haddow
|
||||||
|
Václav Haisman
|
||||||
Paul ten Hagen
|
Paul ten Hagen
|
||||||
Rasmus Hahn
|
Rasmus Hahn
|
||||||
Peter Haight
|
Peter Haight
|
||||||
|
|
|
@ -1495,7 +1495,7 @@ PyMethodDef array_methods[] = {
|
||||||
copy_doc},
|
copy_doc},
|
||||||
{"count", (PyCFunction)array_count, METH_O,
|
{"count", (PyCFunction)array_count, METH_O,
|
||||||
count_doc},
|
count_doc},
|
||||||
{"__deepcopy__",(PyCFunction)array_copy, METH_NOARGS,
|
{"__deepcopy__",(PyCFunction)array_copy, METH_O,
|
||||||
copy_doc},
|
copy_doc},
|
||||||
{"extend", (PyCFunction)array_extend, METH_O,
|
{"extend", (PyCFunction)array_extend, METH_O,
|
||||||
extend_doc},
|
extend_doc},
|
||||||
|
|
Loading…
Reference in New Issue