Skip to content

Commit c0582db

Browse files
[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 3fa92e7) Co-authored-by: Donghee Na <donghee.na@python.org>
1 parent d9a1bff commit c0582db

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Modules/_testinternalcapi/interpreter.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ int Test_EvalFrame_Resumes, Test_EvalFrame_Loads;
1818
static int
1919
stop_tracing_and_jit(PyThreadState *tstate, _PyInterpreterFrame *frame)
2020
{
21-
(void)(tstate);
2221
(void)(frame);
22+
// Don't actually JIT-compile in this test eval-frame, but we still must
23+
// finalize the tracer so the thread-global is_tracing flag is reset.
24+
// Otherwise a trace started inside this duplicated interpreter loop
25+
// (reachable under low JIT thresholds, e.g. PYTHON_JIT_STRESS=1) would
26+
// leave is_tracing stuck true and permanently disable the JIT.
27+
_PyJit_FinalizeTracing(tstate, 0);
2328
return 0;
2429
}
2530
#endif

0 commit comments

Comments
 (0)