https://github.com/python/cpython/commit/c0582dbe7fcfcd5ed71232f88c6fce022f08eabb
commit: c0582dbe7fcfcd5ed71232f88c6fce022f08eabb
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: corona10 <[email protected]>
date: 2026-06-18T12:45:25Z
summary:

[3.15] gh-151229: Finalize JIT tracer in test eval-frame stub (gh-151609) 
(gh-151648)

gh-151229: Finalize JIT tracer in test eval-frame stub (gh-151609)
(cherry picked from commit 3fa92e7c55d74aea062c4b32d895e84d7aaa3bce)

Co-authored-by: Donghee Na <[email protected]>

files:
M Modules/_testinternalcapi/interpreter.c

diff --git a/Modules/_testinternalcapi/interpreter.c 
b/Modules/_testinternalcapi/interpreter.c
index 99dcd18393fb87..4afa028cd87527 100644
--- a/Modules/_testinternalcapi/interpreter.c
+++ b/Modules/_testinternalcapi/interpreter.c
@@ -18,8 +18,13 @@ int Test_EvalFrame_Resumes, Test_EvalFrame_Loads;
 static int
 stop_tracing_and_jit(PyThreadState *tstate, _PyInterpreterFrame *frame)
 {
-    (void)(tstate);
     (void)(frame);
+    // Don't actually JIT-compile in this test eval-frame, but we still must
+    // finalize the tracer so the thread-global is_tracing flag is reset.
+    // Otherwise a trace started inside this duplicated interpreter loop
+    // (reachable under low JIT thresholds, e.g. PYTHON_JIT_STRESS=1) would
+    // leave is_tracing stuck true and permanently disable the JIT.
+    _PyJit_FinalizeTracing(tstate, 0);
     return 0;
 }
 #endif

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to