Skip to content

GH-114743: Set a low recursion limit for test_main_recursion_error() in test_runpy #114772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions Lib/test/test_runpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down