mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-107263: Increase C stack limit for most functions, except _PyEval_EvalFrameDefault()
(GH-107535)
* Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2.
This commit is contained in:
parent
0bd784b355
commit
fa45958450
21 changed files with 57 additions and 45 deletions
|
@ -11,10 +11,9 @@ import textwrap
|
|||
import warnings
|
||||
from test import support
|
||||
from test.support import (script_helper, requires_debug_ranges,
|
||||
requires_specialization)
|
||||
requires_specialization, C_RECURSION_LIMIT)
|
||||
from test.support.os_helper import FakePath
|
||||
|
||||
|
||||
class TestSpecifics(unittest.TestCase):
|
||||
|
||||
def compile_single(self, source):
|
||||
|
@ -112,7 +111,7 @@ class TestSpecifics(unittest.TestCase):
|
|||
|
||||
@unittest.skipIf(support.is_wasi, "exhausts limited stack on WASI")
|
||||
def test_extended_arg(self):
|
||||
repeat = 2000
|
||||
repeat = int(C_RECURSION_LIMIT * 0.9)
|
||||
longexpr = 'x = x or ' + '-x' * repeat
|
||||
g = {}
|
||||
code = textwrap.dedent('''
|
||||
|
@ -558,16 +557,12 @@ class TestSpecifics(unittest.TestCase):
|
|||
@support.cpython_only
|
||||
@unittest.skipIf(support.is_wasi, "exhausts limited stack on WASI")
|
||||
def test_compiler_recursion_limit(self):
|
||||
# Expected limit is sys.getrecursionlimit() * the scaling factor
|
||||
# in symtable.c (currently 3)
|
||||
# We expect to fail *at* that limit, because we use up some of
|
||||
# the stack depth limit in the test suite code
|
||||
# So we check the expected limit and 75% of that
|
||||
# XXX (ncoghlan): duplicating the scaling factor here is a little
|
||||
# ugly. Perhaps it should be exposed somewhere...
|
||||
fail_depth = sys.getrecursionlimit() * 3
|
||||
crash_depth = sys.getrecursionlimit() * 300
|
||||
success_depth = int(fail_depth * 0.75)
|
||||
# Expected limit is C_RECURSION_LIMIT * 2
|
||||
# Duplicating the limit here is a little ugly.
|
||||
# Perhaps it should be exposed somewhere...
|
||||
fail_depth = C_RECURSION_LIMIT * 2 + 1
|
||||
crash_depth = C_RECURSION_LIMIT * 100
|
||||
success_depth = int(C_RECURSION_LIMIT * 1.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