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
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 79e1199..3dd4f6d 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -272,6 +272,12 @@
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 @@
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)