mirror of
https://github.com/python/cpython.git
synced 2025-11-09 18:11:38 +00:00
#3556: test_raiseMemError consumes an insane amount of memory
This commit is contained in:
parent
bebb18bef5
commit
fd7c43e7be
1 changed files with 3 additions and 8 deletions
|
|
@ -1118,14 +1118,9 @@ def test_raiseMemError(self):
|
||||||
# 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: u"a" * (sys.maxsize - 100)
|
||||||
u"a" * (sys.maxint // 2 - 100)
|
self.assertRaises(MemoryError, alloc)
|
||||||
except MemoryError:
|
self.assertRaises(MemoryError, alloc)
|
||||||
pass
|
|
||||||
try:
|
|
||||||
u"a" * (sys.maxint // 2 - 100)
|
|
||||||
except MemoryError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
test_support.run_unittest(__name__)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue