summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAndrew MacIntyre <andymac@bullseye.apana.org.au>2008-10-01 03:25:25 (GMT)
committerAndrew MacIntyre <andymac@bullseye.apana.org.au>2008-10-01 03:25:25 (GMT)
commitbf24401a1f9cc8f4122405c7de1051d7823b6f0c (patch)
treef2c9f5e020e203c038385f561211632def1d857e /Lib/test
parent0806749e631ab4e24f78df347a9d932bbc3cb6c7 (diff)
downloadcpython-bf24401a1f9cc8f4122405c7de1051d7823b6f0c.zip
cpython-bf24401a1f9cc8f4122405c7de1051d7823b6f0c.tar.gz
cpython-bf24401a1f9cc8f4122405c7de1051d7823b6f0c.tar.bz2
fix for issue 3862: test_array fails FreeBSD 7 amd64
FreeBSD 7's underlying malloc() is behaves differently to earlier versions and seriously overcommits available memory on amd64. This may affect other 64bit platforms in some circumstances, so the scale of the problematic test is wound back. Patch by Mark Dickinson, reviewed by Martin von Loewis.
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/test_array.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 34a8f79..2efbc7d 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -1011,20 +1011,21 @@ class DoubleTest(FPTest):
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")
+ self.fail("Array of size > maxsize created - MemoryError expected")
b = array.array('d', [ 2.71828183, 3.14159265, -1])
try:
- b * 1431655766
+ b * (maxsize//3 + 1)
except MemoryError:
pass
else:
- self.fail("a * 1431655766 didn't raise MemoryError")
+ self.fail("Array of size > maxsize created - MemoryError expected")
tests.append(DoubleTest)