Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,10 @@ stop_tracing_and_jit(PyThreadState *tstate, _PyInterpreterFrame *frame)
else {
// Likewise, we hold a strong reference to the executor containing this exit, so the exit is guaranteed
// to be valid to access.
if (!exit->executor->vm_data.linked || !exit->executor->vm_data.valid) {
// gh-141786 Parent executor is either unlinked or invalid - cannot optimize.
err = -1;
}
if (err <= 0) {
exit->temperature = restart_backoff_counter(exit->temperature);
}
Expand Down
6 changes: 5 additions & 1 deletion Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ _PyOptimizer_Optimize(
}
assert(!interp->compiling);
assert(_tstate->jit_tracer_state.initial_state.stack_depth >= 0);
_PyExitData *exit = _tstate->jit_tracer_state.initial_state.exit;
if (exit != NULL && (!exit->executor->vm_data.linked || !exit->executor->vm_data.valid)) {
// gh-141786 Parent executor is either unlinked or invalid - cannot optimize.
return 0;
}
#ifndef Py_GIL_DISABLED
assert(_tstate->jit_tracer_state.initial_state.func != NULL);
interp->compiling = true;
Expand Down Expand Up @@ -185,7 +190,6 @@ _PyOptimizer_Optimize(
else {
executor->vm_data.code = NULL;
}
_PyExitData *exit = _tstate->jit_tracer_state.initial_state.exit;
if (exit != NULL) {
exit->executor = executor;
}
Expand Down
Loading