summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-09-05 22:13:06 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-09-05 22:13:06 (GMT)
commitb305aeb1dd1cd890dae539c63f406a3b803b84f7 (patch)
tree9573633e73cd83783db050eb98d13bf157e8e8ff
parentf04811140339507ff461d5a79be4d088f4f06169 (diff)
downloadcpython-b305aeb1dd1cd890dae539c63f406a3b803b84f7.zip
cpython-b305aeb1dd1cd890dae539c63f406a3b803b84f7.tar.gz
cpython-b305aeb1dd1cd890dae539c63f406a3b803b84f7.tar.bz2
Merged revisions 66235 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r66235 | antoine.pitrou | 2008-09-06 00:04:54 +0200 (sam., 06 sept. 2008) | 6 lines #3601: test_unicode.test_raiseMemError fails in UCS4 Reviewed by Benjamin Peterson on IRC. ........
-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 f82a642..d8c4778 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -1160,7 +1160,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: "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: "a" * (sys.maxsize // charwidth * 2)
self.assertRaises(MemoryError, alloc)
self.assertRaises(MemoryError, alloc)