diff options
author | Mark Shannon <mark@hotpy.org> | 2024-02-13 09:45:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 09:45:59 (GMT) |
commit | 4d87832d8790a2ceb9179ed28b71d83cb2a68ab5 (patch) | |
tree | a3ae020add88d5a3c40fc606e500014b3d23af97 /Parser | |
parent | a30bb080dc5030fbae279088943b7f4dac3558bb (diff) | |
download | cpython-4d87832d8790a2ceb9179ed28b71d83cb2a68ab5.zip cpython-4d87832d8790a2ceb9179ed28b71d83cb2a68ab5.tar.gz cpython-4d87832d8790a2ceb9179ed28b71d83cb2a68ab5.tar.bz2 |
[3.12] GH-112215: Backport C recursion changes (GH-115083)
Diffstat (limited to 'Parser')
-rwxr-xr-x | Parser/asdl_c.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index d42c263..2c34f5c 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -1393,15 +1393,14 @@ PyObject* PyAST_mod2obj(mod_ty t) int starting_recursion_depth; /* Be careful here to prevent overflow. */ - int COMPILER_STACK_FRAME_SCALE = 2; PyThreadState *tstate = _PyThreadState_GET(); if (!tstate) { return NULL; } struct validator vstate; - vstate.recursion_limit = C_RECURSION_LIMIT * COMPILER_STACK_FRAME_SCALE; + vstate.recursion_limit = C_RECURSION_LIMIT; int recursion_depth = C_RECURSION_LIMIT - tstate->c_recursion_remaining; - starting_recursion_depth = recursion_depth * COMPILER_STACK_FRAME_SCALE; + starting_recursion_depth = recursion_depth; vstate.recursion_depth = starting_recursion_depth; PyObject *result = ast2obj_mod(state, &vstate, t); |