mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
add _testcapi.raise_memoryerror to make test_exceptions.test_MemoryError simpler
This commit is contained in:
parent
72dc1eadd9
commit
0067bd68c9
2 changed files with 13 additions and 1 deletions
|
@ -593,9 +593,10 @@ class ExceptionTests(unittest.TestCase):
|
|||
# PyErr_NoMemory always raises the same exception instance.
|
||||
# Check that the traceback is not doubled.
|
||||
import traceback
|
||||
from _testcapi import raise_memoryerror
|
||||
def raiseMemError():
|
||||
try:
|
||||
"a" * (sys.maxsize // 2)
|
||||
raise_memoryerror()
|
||||
except MemoryError as e:
|
||||
tb = e.__traceback__
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue