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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a crash in the experimental JIT when a finalizer invalidates an
executor while ``stop_tracing`` leaves the tracer.
2 changes: 2 additions & 0 deletions Modules/_testinternalcapi/test_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -6636,6 +6636,16 @@ dummy_func(
LEAVE_TRACING();
int err = stop_tracing_and_jit(tstate, frame);
ERROR_IF(err < 0);
/* stop_tracing_and_jit() can drop the last reference to a
temporary and run a finalizer. A ResourceWarning then writes
__warningregistry__ into a watched globals dict, and
executor_invalidate() restores this instruction and clears its
executor slot. Dispatching the ENTER_EXECUTOR opcode sampled
above calls _PyJIT_Entry(NULL). Keep any EXTENDED_ARG bits
already accumulated in oparg; only the low byte lives in the
code unit. */
opcode = next_instr->op.code;
oparg = (oparg & ~255) | next_instr->op.arg;
DISPATCH_GOTO_NON_TRACING();
#else
Py_FatalError("JIT label executed in non-jit build.");
Expand Down
2 changes: 2 additions & 0 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading