Skip to content

Commit

Permalink
Move opcode tracing to occur after the possible update to f_lineno. (G…
Browse files Browse the repository at this point in the history
  • Loading branch information
gwk authored and ncoghlan committed Oct 19, 2017
1 parent 0b6a118 commit 20faa68
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Python/ceval.c
Expand Up @@ -4416,10 +4416,6 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
*instr_lb = bounds.ap_lower;
*instr_ub = bounds.ap_upper;
}
/* Always emit an opcode event if we're tracing all opcodes. */
if (frame->f_trace_opcodes) {
result = call_trace(func, obj, tstate, frame, PyTrace_OPCODE, Py_None);
}
/* If the last instruction falls at the start of a line or if it
represents a jump backwards, update the frame's line number and
then call the trace function if we're tracing source lines.
Expand All @@ -4430,6 +4426,10 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None);
}
}
/* Always emit an opcode event if we're tracing all opcodes. */
if (frame->f_trace_opcodes) {
result = call_trace(func, obj, tstate, frame, PyTrace_OPCODE, Py_None);
}
*instr_prev = frame->f_lasti;
return result;
}
Expand Down

0 comments on commit 20faa68

Please sign in to comment.