summaryrefslogtreecommitdiffstats
path: root/Python/ast_opt.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-02-13 09:45:59 (GMT)
committerGitHub <noreply@github.com>2024-02-13 09:45:59 (GMT)
commit4d87832d8790a2ceb9179ed28b71d83cb2a68ab5 (patch)
treea3ae020add88d5a3c40fc606e500014b3d23af97 /Python/ast_opt.c
parenta30bb080dc5030fbae279088943b7f4dac3558bb (diff)
downloadcpython-4d87832d8790a2ceb9179ed28b71d83cb2a68ab5.zip
cpython-4d87832d8790a2ceb9179ed28b71d83cb2a68ab5.tar.gz
cpython-4d87832d8790a2ceb9179ed28b71d83cb2a68ab5.tar.bz2
[3.12] GH-112215: Backport C recursion changes (GH-115083)
Diffstat (limited to 'Python/ast_opt.c')
-rw-r--r--Python/ast_opt.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index f8c4a95..e881b7f 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -1102,9 +1102,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, _PyASTOptimizeState *state)
{
@@ -1118,9 +1115,9 @@ _PyAST_Optimize(mod_ty mod, PyArena *arena, _PyASTOptimizeState *state)
}
/* 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;
int ret = astfold_mod(mod, arena, state);
assert(ret || PyErr_Occurred());