diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-09-18 15:40:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-18 15:40:51 (GMT) |
commit | 9412a874a765da1241f9ea7c1fb689152d155004 (patch) | |
tree | a9f9f88a49d8c83b5cb32c055c739b5e4cb32b5d /Python | |
parent | 2401b980da571cac49c804edb66696766c4cd9c0 (diff) | |
download | cpython-9412a874a765da1241f9ea7c1fb689152d155004.zip cpython-9412a874a765da1241f9ea7c1fb689152d155004.tar.gz cpython-9412a874a765da1241f9ea7c1fb689152d155004.tar.bz2 |
[3.12] gh-109371: Fix monitoring with instruction events set (gh-109385) (#109542)
gh-109371: Fix monitoring with instruction events set (gh-109385)
(cherry picked from commit 412f5e85d6b9f2e90c57c54539d06c7a025a472a)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/instrumentation.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/instrumentation.c b/Python/instrumentation.c index 0a54eb6..a6ff7a8 100644 --- a/Python/instrumentation.c +++ b/Python/instrumentation.c @@ -647,7 +647,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); @@ -1252,6 +1252,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]; |