mirror of
https://github.com/python/cpython.git
synced 2025-12-01 15:24:51 +00:00
#3601: test_unicode.test_raiseMemError fails in UCS4
Reviewed by Benjamin Peterson on IRC.
This commit is contained in:
parent
32476fc5a8
commit
187ac1bda4
1 changed files with 4 additions and 1 deletions
|
|
@ -1118,7 +1118,10 @@ class UnicodeTest(
|
||||||
# when a string allocation fails with a MemoryError.
|
# when a string allocation fails with a MemoryError.
|
||||||
# This used to crash the interpreter,
|
# This used to crash the interpreter,
|
||||||
# or leak references when the number was smaller.
|
# 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)
|
||||||
self.assertRaises(MemoryError, alloc)
|
self.assertRaises(MemoryError, alloc)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue