mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
GH-113655: Lower the C recursion limit on various platforms (GH-113944)
This commit is contained in:
parent
6c502ba809
commit
17b73ab99e
13 changed files with 41 additions and 39 deletions
|
@ -1100,9 +1100,6 @@ astfold_type_param(type_param_ty node_, PyArena *ctx_, _PyASTOptimizeState *stat
|
|||
#undef CALL_OPT
|
||||
#undef CALL_SEQ
|
||||
|
||||
/* See comments in symtable.c. */
|
||||
#define COMPILER_STACK_FRAME_SCALE 2
|
||||
|
||||
int
|
||||
_PyAST_Optimize(mod_ty mod, PyArena *arena, int optimize, int ff_features)
|
||||
{
|
||||
|
@ -1120,9 +1117,9 @@ _PyAST_Optimize(mod_ty mod, PyArena *arena, int optimize, int ff_features)
|
|||
}
|
||||
/* Be careful here to prevent overflow. */
|
||||
int recursion_depth = Py_C_RECURSION_LIMIT - tstate->c_recursion_remaining;
|
||||
starting_recursion_depth = recursion_depth * COMPILER_STACK_FRAME_SCALE;
|
||||
starting_recursion_depth = recursion_depth;
|
||||
state.recursion_depth = starting_recursion_depth;
|
||||
state.recursion_limit = Py_C_RECURSION_LIMIT * COMPILER_STACK_FRAME_SCALE;
|
||||
state.recursion_limit = Py_C_RECURSION_LIMIT;
|
||||
|
||||
int ret = astfold_mod(mod, arena, &state);
|
||||
assert(ret || PyErr_Occurred());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue