https://github.com/python/cpython/commit/c4ab024530feb3a66d51bcef2e33b309ca0d543f
commit: c4ab024530feb3a66d51bcef2e33b309ca0d543f
branch: main
author: Ken Jin <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2025-12-23T11:27:23Z
summary:
gh-142448: Disable JIT tracing when monitoring is enabled (GH-142842)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2025-12-16-20-38-17.gh-issue-142448.mAFqwL.rst
M Python/bytecodes.c
M Python/generated_cases.c.h
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2025-12-16-20-38-17.gh-issue-142448.mAFqwL.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2025-12-16-20-38-17.gh-issue-142448.mAFqwL.rst
new file mode 100644
index 00000000000000..bcc7c1fb12d094
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2025-12-16-20-38-17.gh-issue-142448.mAFqwL.rst
@@ -0,0 +1 @@
+Fix a bug when using monitoring with the JIT.
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index da06d53f14455c..5c23b2f0cc989a 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -5575,9 +5575,14 @@ dummy_func(
next_instr = this_instr;
frame->instr_ptr = prev_instr;
opcode = next_instr->op.code;
- bool stop_tracing = (opcode == WITH_EXCEPT_START ||
- opcode == RERAISE || opcode == CLEANUP_THROW ||
- opcode == PUSH_EXC_INFO || opcode == INTERPRETER_EXIT);
+ bool stop_tracing = (
+ opcode == WITH_EXCEPT_START ||
+ opcode == RERAISE ||
+ opcode == CLEANUP_THROW ||
+ opcode == PUSH_EXC_INFO ||
+ opcode == INTERPRETER_EXIT ||
+ (opcode >= MIN_INSTRUMENTED_OPCODE && opcode != ENTER_EXECUTOR)
+ );
int full = !_PyJit_translate_single_bytecode_to_trace(tstate,
frame, next_instr, stop_tracing ? _DEOPT : 0);
if (full) {
LEAVE_TRACING();
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index e562f337a0049f..791df8a9750480 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -11387,9 +11387,14 @@
next_instr = this_instr;
frame->instr_ptr = prev_instr;
opcode = next_instr->op.code;
- bool stop_tracing = (opcode == WITH_EXCEPT_START ||
- opcode == RERAISE || opcode == CLEANUP_THROW
||
- opcode == PUSH_EXC_INFO || opcode ==
INTERPRETER_EXIT);
+ bool stop_tracing = (
+ opcode == WITH_EXCEPT_START ||
+ opcode == RERAISE ||
+ opcode == CLEANUP_THROW ||
+ opcode == PUSH_EXC_INFO ||
+ opcode == INTERPRETER_EXIT ||
+ (opcode >= MIN_INSTRUMENTED_OPCODE && opcode
!= ENTER_EXECUTOR)
+ );
_PyFrame_SetStackPointer(frame, stack_pointer);
int full = !_PyJit_translate_single_bytecode_to_trace(tstate,
frame, next_instr, stop_tracing ? _DEOPT : 0);
stack_pointer = _PyFrame_GetStackPointer(frame);
_______________________________________________
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]