Skip to content

Commit 2ed8f92

Browse files
authored
GH-114743: Set a low recursion limit for test_main_recursion_error() in test_runpy (GH-114772)
This can fail under a debug build of WASI when directly executing test.test_runpy.
1 parent 5742919 commit 2ed8f92

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,5 @@ Python/frozen_modules/MANIFEST
159159
/python
160160
!/Python/
161161

162-
# main branch only: ABI files are not checked/maintained
162+
# main branch only: ABI files are not checked/maintained.
163163
Doc/data/python*.abi

Lib/test/test_runpy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import textwrap
1313
import unittest
1414
import warnings
15-
from test.support import no_tracing, verbose, requires_subprocess, requires_resource
15+
from test.support import (infinite_recursion, no_tracing, verbose,
16+
requires_subprocess, requires_resource)
1617
from test.support.import_helper import forget, make_legacy_pyc, unload
1718
from test.support.os_helper import create_empty_file, temp_dir
1819
from test.support.script_helper import make_script, make_zip_script
@@ -743,7 +744,8 @@ def test_main_recursion_error(self):
743744
"runpy.run_path(%r)\n") % dummy_dir
744745
script_name = self._make_test_script(script_dir, mod_name, source)
745746
zip_name, fname = make_zip_script(script_dir, 'test_zip', script_name)
746-
self.assertRaises(RecursionError, run_path, zip_name)
747+
with infinite_recursion(25):
748+
self.assertRaises(RecursionError, run_path, zip_name)
747749

748750
def test_encoding(self):
749751
with temp_dir() as script_dir:

0 commit comments

Comments
 (0)