mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix array.extend and array.__iadd__ to handle the case where an array
is extended with itself. This bug is specific the py3k version of arraymodule.c
This commit is contained in:
parent
b78637a5bc
commit
e503cf9b0e
2 changed files with 18 additions and 3 deletions
|
@ -272,6 +272,12 @@ class BaseTest(unittest.TestCase):
|
|||
a,
|
||||
array.array(self.typecode, self.example[::-1]+2*self.example)
|
||||
)
|
||||
a = array.array(self.typecode, self.example)
|
||||
a += a
|
||||
self.assertEqual(
|
||||
a,
|
||||
array.array(self.typecode, self.example + self.example)
|
||||
)
|
||||
|
||||
b = array.array(self.badtypecode())
|
||||
self.assertRaises(TypeError, a.__add__, b)
|
||||
|
@ -667,6 +673,13 @@ class BaseTest(unittest.TestCase):
|
|||
array.array(self.typecode, self.example+self.example[::-1])
|
||||
)
|
||||
|
||||
a = array.array(self.typecode, self.example)
|
||||
a.extend(a)
|
||||
self.assertEqual(
|
||||
a,
|
||||
array.array(self.typecode, self.example+self.example)
|
||||
)
|
||||
|
||||
b = array.array(self.badtypecode())
|
||||
self.assertRaises(TypeError, a.extend, b)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue