aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2023-09-18 07:30:08 -0700
committerGitHub <noreply@github.com>2023-09-18 23:30:08 +0900
commit412f5e85d6b9f2e90c57c54539d06c7a025a472a (patch)
tree83ad67b4151ed3b06455d85f03fe84858b5b1bdb /Python
parent23f9f6f46454455bc6015e83ae5b5e946dae7698 (diff)
downloadcpython-412f5e85d6b9f2e90c57c54539d06c7a025a472a.tar.gz
cpython-412f5e85d6b9f2e90c57c54539d06c7a025a472a.zip
gh-109371: Fix monitoring with instruction events set (gh-109385)
Diffstat (limited to 'Python')
-rw-r--r--Python/instrumentation.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/instrumentation.c b/Python/instrumentation.c
index 0768c82ba29..df8943b1f9a 100644
--- a/Python/instrumentation.c
+++ b/Python/instrumentation.c
@@ -664,7 +664,7 @@ instrument(PyCodeObject *code, int i)
if (opcode == INSTRUMENTED_INSTRUCTION) {
opcode_ptr = &code->_co_monitoring->per_instruction_opcodes[i];
opcode = *opcode_ptr;
- CHECK(!is_instrumented(opcode));
+ CHECK(opcode != INSTRUMENTED_INSTRUCTION && opcode != INSTRUMENTED_LINE);
CHECK(opcode == _PyOpcode_Deopt[opcode]);
}
CHECK(opcode != 0);
@@ -1295,6 +1295,9 @@ initialize_tools(PyCodeObject *code)
if (opcode == INSTRUMENTED_LINE) {
opcode = code->_co_monitoring->lines[i].original_opcode;
}
+ if (opcode == INSTRUMENTED_INSTRUCTION) {
+ opcode = code->_co_monitoring->per_instruction_opcodes[i];
+ }
bool instrumented = is_instrumented(opcode);
if (instrumented) {
opcode = DE_INSTRUMENT[opcode];