Clarify logic about what instructions to line trace.

This commit is contained in:
Mark Shannon 2021-01-05 11:05:40 +00:00
parent 22b8c992ea
commit 5028a2e118
1 changed files with 5 additions and 2 deletions

View File

@ -5000,8 +5000,11 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
*/
int lastline = bounds->ar_line;
int line = _PyCode_CheckLineNumber(frame->f_lasti, bounds);
if (frame->f_lasti < *instr_prev || (line != lastline && frame->f_lasti == bounds->ar_start)) {
if (line != -1 && frame->f_trace_lines) {
if (line != -1 && frame->f_trace_lines) {
/* Trace backward edges or first instruction of a new line */
if (frame->f_lasti < *instr_prev ||
(line != lastline && frame->f_lasti == bounds->ar_start))
{
frame->f_lineno = line;
result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None);
frame->f_lineno = 0;