summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/test_array.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 3f8b683..5b6b9f2 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -962,6 +962,23 @@ tests.append(FloatTest)
class DoubleTest(FPTest):
typecode = 'd'
minitemsize = 8
+
+ def test_alloc_overflow(self):
+ a = array.array('d', [-1]*65536)
+ try:
+ a *= 65536
+ except MemoryError:
+ pass
+ else:
+ self.fail("a *= 2**16 didn't raise MemoryError")
+ b = array.array('d', [ 2.71828183, 3.14159265, -1])
+ try:
+ b * 1431655766
+ except MemoryError:
+ pass
+ else:
+ self.fail("a * 1431655766 didn't raise MemoryError")
+
tests.append(DoubleTest)
def test_main(verbose=None):