Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_array.py @ 49362:ea53163b06de legacy-trunk
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.
| author | Andrew MacIntyre <andymac@bullseye.apana.org.au> |
|---|---|
| date | Wed, 01 Oct 2008 03:25:25 +0000 |
| parents | 1c964ed35ef9 |
| children | e673632e1885 |
line wrap: on
line diff
--- a/Lib/test/test_array.py Tue Sep 30 20:41:13 2008 +0000 +++ b/Lib/test/test_array.py Wed Oct 01 03:25:25 2008 +0000 @@ -1011,20 +1011,21 @@ 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)
