Index: Lib/test/test_array.py =================================================================== --- Lib/test/test_array.py (revision 65961) +++ Lib/test/test_array.py (working copy) @@ -1011,16 +1011,17 @@ minitemsize = 8 def test_alloc_overflow(self): + from sys import maxsize a = array.array('d', [-1]*65536) try: - a *= 65536 + a *= maxsize//65536 + 1 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 + b * maxsize//3 + 1 except MemoryError: pass else: