mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-116303: Skip tests if C recursion limit is unavailable (GH-117368)
The test suite fetches the C recursion limit from the _testcapi extension module. Test extension modules can be disabled using the --disable-test-modules configure option.
This commit is contained in:
parent
9a12f5d1c1
commit
ca62ffd1a5
14 changed files with 32 additions and 35 deletions
|
@ -13,7 +13,7 @@ import textwrap
|
|||
import warnings
|
||||
from test import support
|
||||
from test.support import (script_helper, requires_debug_ranges,
|
||||
requires_specialization, Py_C_RECURSION_LIMIT)
|
||||
requires_specialization, get_c_recursion_limit)
|
||||
from test.support.bytecode_helper import instructions_with_positions
|
||||
from test.support.os_helper import FakePath
|
||||
|
||||
|
@ -114,7 +114,7 @@ class TestSpecifics(unittest.TestCase):
|
|||
|
||||
@unittest.skipIf(support.is_wasi, "exhausts limited stack on WASI")
|
||||
def test_extended_arg(self):
|
||||
repeat = int(Py_C_RECURSION_LIMIT * 0.9)
|
||||
repeat = int(get_c_recursion_limit() * 0.9)
|
||||
longexpr = 'x = x or ' + '-x' * repeat
|
||||
g = {}
|
||||
code = textwrap.dedent('''
|
||||
|
@ -634,9 +634,10 @@ class TestSpecifics(unittest.TestCase):
|
|||
@unittest.skipIf(support.is_wasi, "exhausts limited stack on WASI")
|
||||
def test_compiler_recursion_limit(self):
|
||||
# Expected limit is Py_C_RECURSION_LIMIT
|
||||
fail_depth = Py_C_RECURSION_LIMIT + 1
|
||||
crash_depth = Py_C_RECURSION_LIMIT * 100
|
||||
success_depth = int(Py_C_RECURSION_LIMIT * 0.8)
|
||||
limit = get_c_recursion_limit()
|
||||
fail_depth = limit + 1
|
||||
crash_depth = limit * 100
|
||||
success_depth = int(limit * 0.8)
|
||||
|
||||
def check_limit(prefix, repeated, mode="single"):
|
||||
expect_ok = prefix + repeated * success_depth
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue