[issue13548] Invalid 'line' tracer event on pass within else clause

Jelle Zijlstra report at bugs.python.org
Thu Jun 2 13:06:41 EDT 2016


Jelle Zijlstra added the comment:

The reason for this behavior is that the trace function is called whenever execution in the bytecode jumps to a new source line. See ceval.c line 4440 or so:

    /* 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 call the trace function. */

Running dis.dis on x in the example file shows that the bytecode for returning None is assigned to the "pass" line.

I think the bug here is really with the line number assignment in the bytecode, not with the tracing, but I don't see an obvious way to fix it.

----------
nosy: +Jelle Zijlstra

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13548>
_______________________________________


More information about the Python-bugs-list mailing list