diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-05-22 23:19:17 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-05-22 23:19:17 (GMT) |
commit | d4e5be53409699d89c358bd16784bad59c37dfa7 (patch) | |
tree | e73ff4030deebb52034b224a1525e3a4e8bba5f0 /Lib | |
parent | 7779b208aedd9622029b20712c918c97a2c67eed (diff) | |
download | cpython-d4e5be53409699d89c358bd16784bad59c37dfa7.zip cpython-d4e5be53409699d89c358bd16784bad59c37dfa7.tar.gz cpython-d4e5be53409699d89c358bd16784bad59c37dfa7.tar.bz2 |
Closes: #556025 seg fault when doing list(xrange(1e9))
A MemoryError is now raised when the list cannot be created.
There is a test, but as the comment says, it really only
works for 32 bit systems. I don't know how to improve
the test for other systems (ie, 64 bit or systems
where the data size != addressable size,
e.g. 64 bit data, but 48 bit addressable memory)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_b1.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py index 554e350..56a5f78 100644 --- a/Lib/test/test_b1.py +++ b/Lib/test/test_b1.py @@ -514,6 +514,17 @@ if list((0, 1, 2, 3)) != [0, 1, 2, 3]: raise TestFailed, 'list((0, 1, 2, 3))' if list('') != []: raise TestFailed, 'list('')' if list('spam') != ['s', 'p', 'a', 'm']: raise TestFailed, "list('spam')" +try: + # Verify clearing of bug #556025 + # this assumes that the max data size (sys.maxint) == max address size + # this also assumes that the address size is at least 4 bytes + # with 8 byte addresses, the bug is not well tested + list(xrange(sys.maxint / 4)) +except MemoryError: + pass +else: + raise TestFailed, 'list(xrange(sys.maxint / 4))' + print 'long' if long(314) != 314L: raise TestFailed, 'long(314)' if long(3.14) != 3L: raise TestFailed, 'long(3.14)' |