File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1849,11 +1849,13 @@ def test_memory_error_in_subinterp(self):
18491849 @unittest .skipIf (support .Py_TRACE_REFS , 'cannot test Py_TRACE_REFS build' )
18501850 def test_exec_set_nomemory_hang (self ):
18511851 import_module ("_testcapi" )
1852- # gh-134163: Test case that triggers no memory hang condition
1853- # The frame_lasti need to upper 257,
1854- # because when calling PyLong_FromLong, malloc is not invoked,
1855- # so no MemError is triggered
1856- # we need to warm up the memory to reproduce the issue
1852+ # gh-134163: A MemoryError inside code that was wrapped by a try/except
1853+ # block would lead to an infinite loop.
1854+
1855+ # The frame_lasti needs to be greater than 257 to prevent
1856+ # PyLong_FromLong() from returning cached integers, which
1857+ # don't require a memory allocation. Prepend some dummy code
1858+ # to artificially increase the instruction index.
18571859 warmup_code = "a = list(range(0, 1))\n " * 20
18581860 user_input = warmup_code + dedent ("""
18591861 try:
You can’t perform that action at this time.
0 commit comments