diff options
author | Mark Shannon <mark@hotpy.org> | 2024-01-16 09:32:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 09:32:01 (GMT) |
commit | 17b73ab99ef12f89d41acec7500a244e68b1aaa4 (patch) | |
tree | bcde8fca4dc4dae4f9ed5369a4ea23bb825f15bb /Python/Python-ast.c | |
parent | 6c502ba809ff662a5eebf8c6778dec6bd28918fb (diff) | |
download | cpython-17b73ab99ef12f89d41acec7500a244e68b1aaa4.zip cpython-17b73ab99ef12f89d41acec7500a244e68b1aaa4.tar.gz cpython-17b73ab99ef12f89d41acec7500a244e68b1aaa4.tar.bz2 |
GH-113655: Lower the C recursion limit on various platforms (GH-113944)
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r-- | Python/Python-ast.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 699e1c1..d77e986 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -13149,15 +13149,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 = Py_C_RECURSION_LIMIT * COMPILER_STACK_FRAME_SCALE; + vstate.recursion_limit = Py_C_RECURSION_LIMIT; 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; vstate.recursion_depth = starting_recursion_depth; PyObject *result = ast2obj_mod(state, &vstate, t); |