We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09a19c2 commit ed2793bCopy full SHA for ed2793b
Lib/test/test_exceptions.py
@@ -1920,6 +1920,13 @@ def test_keyerror_context(self):
1920
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
1921
def test_exec_set_nomemory_hang(self):
1922
import_module("_testcapi")
1923
+ # gh-134163: A MemoryError inside code that was wrapped by a try/except
1924
+ # block would lead to an infinite loop.
1925
+
1926
+ # The frame_lasti needs to be greater than 257 to prevent
1927
+ # PyLong_FromLong() from returning cached integers, which
1928
+ # don't require a memory allocation. Prepend some dummy code
1929
+ # to artificially increase the instruction index.
1930
warmup_code = "a = list(range(0, 1))\n" * 20
1931
user_input = warmup_code + dedent("""
1932
try:
0 commit comments