mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Merged revisions 65773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r65773 | antoine.pitrou | 2008-08-17 19:01:49 +0200 (dim., 17 août 2008) | 3 lines #3556: test_raiseMemError consumes an insane amount of memory ........
This commit is contained in:
parent
43e45192bd
commit
3db3e87434
1 changed files with 4 additions and 9 deletions
|
@ -1155,20 +1155,15 @@ class UnicodeTest(
|
||||||
return
|
return
|
||||||
self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
|
self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
|
||||||
|
|
||||||
|
|
||||||
def test_raiseMemError(self):
|
def test_raiseMemError(self):
|
||||||
# Ensure that the freelist contains a consistent object, even
|
# Ensure that the freelist contains a consistent object, even
|
||||||
# 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.
|
||||||
try:
|
alloc = lambda: "a" * (sys.maxsize - 100)
|
||||||
"a" * (sys.maxsize // 2 - 100)
|
self.assertRaises(MemoryError, alloc)
|
||||||
except MemoryError:
|
self.assertRaises(MemoryError, alloc)
|
||||||
pass
|
|
||||||
try:
|
|
||||||
"a" * (sys.maxsize // 2 - 100)
|
|
||||||
except MemoryError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue