mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
[3.12] GH-112215: Backport C recursion changes (GH-115083)
This commit is contained in:
parent
a30bb080dc
commit
4d87832d87
14 changed files with 65 additions and 46 deletions
|
@ -1038,9 +1038,6 @@ validate_type_params(struct validator *state, asdl_type_param_seq *tps)
|
|||
}
|
||||
|
||||
|
||||
/* See comments in symtable.c. */
|
||||
#define COMPILER_STACK_FRAME_SCALE 2
|
||||
|
||||
int
|
||||
_PyAST_Validate(mod_ty mod)
|
||||
{
|
||||
|
@ -1057,9 +1054,9 @@ _PyAST_Validate(mod_ty mod)
|
|||
}
|
||||
/* Be careful here to prevent overflow. */
|
||||
int recursion_depth = 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 = C_RECURSION_LIMIT * COMPILER_STACK_FRAME_SCALE;
|
||||
state.recursion_limit = C_RECURSION_LIMIT;
|
||||
|
||||
switch (mod->kind) {
|
||||
case Module_kind:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue