[Python-checkins] gh-103082: remove assumption that INSTRUMENTED_LINE is the last instrumented opcode (#107978)

iritkatriel webhook-mailer at python.org
Tue Aug 15 11:40:09 EDT 2023


https://github.com/python/cpython/commit/971a4c27517e76155a4a489096eba69c53a7b9e9
commit: 971a4c27517e76155a4a489096eba69c53a7b9e9
branch: main
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2023-08-15T16:40:05+01:00
summary:

gh-103082: remove assumption that INSTRUMENTED_LINE is the last instrumented opcode (#107978)

files:
M Python/instrumentation.c

diff --git a/Python/instrumentation.c b/Python/instrumentation.c
index b50e8e26476cd..48befed4ea838 100644
--- a/Python/instrumentation.c
+++ b/Python/instrumentation.c
@@ -121,7 +121,7 @@ static inline bool
 opcode_has_event(int opcode)
 {
     return (
-        opcode < INSTRUMENTED_LINE &&
+        opcode != INSTRUMENTED_LINE &&
         INSTRUMENTED_OPCODES[opcode] > 0
     );
 }
@@ -1202,7 +1202,7 @@ _Py_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame,
     Py_DECREF(line_obj);
 done:
     assert(original_opcode != 0);
-    assert(original_opcode < INSTRUMENTED_LINE);
+    assert(original_opcode != INSTRUMENTED_LINE);
     assert(_PyOpcode_Deopt[original_opcode] == original_opcode);
     return original_opcode;
 }



More information about the Python-checkins mailing list