Skip to content

Commit 688f063

Browse files
Another solution
1 parent 937b990 commit 688f063

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Python/optimizer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ _PyOptimizer_Optimize(
118118
{
119119
_PyStackRef *stack_pointer = frame->stackpointer;
120120
PyInterpreterState *interp = _PyInterpreterState_GET();
121-
assert(interp->jit);
121+
if (!interp->jit) {
122+
return 0;
123+
}
122124
assert(!interp->compiling);
123125
#ifndef Py_GIL_DISABLED
124126
interp->compiling = true;

Python/pylifecycle.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,8 @@ finalize_modules(PyThreadState *tstate)
17081708
{
17091709
PyInterpreterState *interp = tstate->interp;
17101710

1711-
// Invalidate all executors
1711+
// Invalidate all executors and turn off JIT:
1712+
interp->jit = false;
17121713
interp->compiling = false;
17131714
#ifdef _Py_TIER2
17141715
_Py_Executors_InvalidateAll(interp, 0);

0 commit comments

Comments
 (0)