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

This commit is contained in:
Irit Katriel 2023-08-15 16:40:05 +01:00 committed by GitHub
parent 0932272431
commit 971a4c2751
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,7 +121,7 @@ static inline bool
opcode_has_event(int opcode) opcode_has_event(int opcode)
{ {
return ( return (
opcode < INSTRUMENTED_LINE && opcode != INSTRUMENTED_LINE &&
INSTRUMENTED_OPCODES[opcode] > 0 INSTRUMENTED_OPCODES[opcode] > 0
); );
} }
@ -1202,7 +1202,7 @@ _Py_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame,
Py_DECREF(line_obj); Py_DECREF(line_obj);
done: done:
assert(original_opcode != 0); assert(original_opcode != 0);
assert(original_opcode < INSTRUMENTED_LINE); assert(original_opcode != INSTRUMENTED_LINE);
assert(_PyOpcode_Deopt[original_opcode] == original_opcode); assert(_PyOpcode_Deopt[original_opcode] == original_opcode);
return original_opcode; return original_opcode;
} }