summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-09-05 22:04:54 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-09-05 22:04:54 (GMT)
commit187ac1bda4fdab0dba7df4a9362c48edf6b55ba4 (patch)
treec780ccb8e4d31af6ab5e302c70c969fee86a94c2 /Lib/test
parent32476fc5a8c1e4bdfab04ab09b254a3c833e5785 (diff)
downloadcpython-187ac1bda4fdab0dba7df4a9362c48edf6b55ba4.zip
cpython-187ac1bda4fdab0dba7df4a9362c48edf6b55ba4.tar.gz
cpython-187ac1bda4fdab0dba7df4a9362c48edf6b55ba4.tar.bz2
#3601: test_unicode.test_raiseMemError fails in UCS4
Reviewed by Benjamin Peterson on IRC.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_unicode.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 5d887ed..70e4787 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -1118,7 +1118,10 @@ class UnicodeTest(
# when a string allocation fails with a MemoryError.
# This used to crash the interpreter,
# or leak references when the number was smaller.
- alloc = lambda: u"a" * (sys.maxsize - 100)
+ charwidth = 4 if sys.maxunicode >= 0x10000 else 2
+ # Note: sys.maxsize is half of the actual max allocation because of
+ # the signedness of Py_ssize_t.
+ alloc = lambda: u"a" * (sys.maxsize // charwidth * 2)
self.assertRaises(MemoryError, alloc)
self.assertRaises(MemoryError, alloc)