Skip to content

Commit 20faa68

Browse files
gwkncoghlan
authored andcommitted
Move opcode tracing to occur after the possible update to f_lineno. (GH-3798)
1 parent 0b6a118 commit 20faa68

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Python/ceval.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4416,10 +4416,6 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
44164416
*instr_lb = bounds.ap_lower;
44174417
*instr_ub = bounds.ap_upper;
44184418
}
4419-
/* Always emit an opcode event if we're tracing all opcodes. */
4420-
if (frame->f_trace_opcodes) {
4421-
result = call_trace(func, obj, tstate, frame, PyTrace_OPCODE, Py_None);
4422-
}
44234419
/* If the last instruction falls at the start of a line or if it
44244420
represents a jump backwards, update the frame's line number and
44254421
then call the trace function if we're tracing source lines.
@@ -4430,6 +4426,10 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
44304426
result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None);
44314427
}
44324428
}
4429+
/* Always emit an opcode event if we're tracing all opcodes. */
4430+
if (frame->f_trace_opcodes) {
4431+
result = call_trace(func, obj, tstate, frame, PyTrace_OPCODE, Py_None);
4432+
}
44334433
*instr_prev = frame->f_lasti;
44344434
return result;
44354435
}

0 commit comments

Comments
 (0)