diff options
author | Mark Shannon <mark@hotpy.org> | 2021-11-16 11:01:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 11:01:57 +0000 |
commit | b9310773756f40f77e075f221a90dd41e6964efc (patch) | |
tree | 43674ba9f42f2ff81dfd3025956b0ce8e12251f9 /Python/pystate.c | |
parent | 9bf2cbc4c498812e14f20d86acb61c53928a5a57 (diff) | |
download | cpython-b9310773756f40f77e075f221a90dd41e6964efc.tar.gz cpython-b9310773756f40f77e075f221a90dd41e6964efc.zip |
bpo-45753: Make recursion checks more efficient. (GH-29524)
* Uses recursion remaining, instead of recursion depth to speed up check against recursion limit.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index a9ed08a7e34..8df28078f2a 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -636,9 +636,9 @@ new_threadstate(PyInterpreterState *interp, int init) tstate->interp = interp; - tstate->recursion_depth = 0; + tstate->recursion_limit = interp->ceval.recursion_limit; + tstate->recursion_remaining = interp->ceval.recursion_limit; tstate->recursion_headroom = 0; - tstate->stackcheck_counter = 0; tstate->tracing = 0; tstate->root_cframe.use_tracing = 0; tstate->root_cframe.current_frame = NULL; |