GH-114743: Set a low recursion limit for `test_main_recursion_error()` in `test_runpy` (GH-114772)
![](https://secure.gravatar.com/avatar/cc7737cd64a84f1b5c61a160798e97ee.jpg?s=120&d=mm&r=g)
https://github.com/python/cpython/commit/2ed8f924ee05ec17ce0639a424e5ca7661b... commit: 2ed8f924ee05ec17ce0639a424e5ca7661b09a6b branch: main author: Brett Cannon <brett@python.org> committer: brettcannon <brett@python.org> date: 2024-01-31T01:49:27Z summary: 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. files: M .gitignore M Lib/test/test_runpy.py diff --git a/.gitignore b/.gitignore index 18eb2a9f0632ce..6ed7197e3ab626 100644 --- a/.gitignore +++ b/.gitignore @@ -159,5 +159,5 @@ Python/frozen_modules/MANIFEST /python !/Python/ -# main branch only: ABI files are not checked/maintained +# main branch only: ABI files are not checked/maintained. Doc/data/python*.abi diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py index 57fe859e366b5b..9d76764c75be3e 100644 --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -12,7 +12,8 @@ import textwrap import unittest import warnings -from test.support import no_tracing, verbose, requires_subprocess, requires_resource +from test.support import (infinite_recursion, no_tracing, verbose, + requires_subprocess, requires_resource) from test.support.import_helper import forget, make_legacy_pyc, unload from test.support.os_helper import create_empty_file, temp_dir from test.support.script_helper import make_script, make_zip_script @@ -743,7 +744,8 @@ def test_main_recursion_error(self): "runpy.run_path(%r)\n") % dummy_dir script_name = self._make_test_script(script_dir, mod_name, source) zip_name, fname = make_zip_script(script_dir, 'test_zip', script_name) - self.assertRaises(RecursionError, run_path, zip_name) + with infinite_recursion(25): + self.assertRaises(RecursionError, run_path, zip_name) def test_encoding(self): with temp_dir() as script_dir:
participants (1)
-
brettcannon