Message40709
Logged In: YES
user_id=4771
Two bugs. Try single-stepping in the following code:
x = 5
del x
while 0:
bla
print "done."
It skips the "del x" line and stops on the "bla" line. The
former is caused by a simple typo in maybe_call_trace_line()
where the test 'frame->f_lasti > *instr_ub' should be '>=',
skipping altogether lines corresponding to a single opcode.
The origin of the 2nd bug is that the POP_TOP and
RETURN_NONE special-casing trick is limited; there are
situations where the compiler emits other "trailing" opcodes
as well. The above example can be solved by adding POP_BLOCK
to the list.
However I would claim that a more long-term-reliable
solution is needed. A close emulation of what SET_LINENO
used to do could easily be obtained by discarding any line
change event which jumps directly in the middle of a line.
After all, no SET_LINENO used to be detected in this case
either. (This would make RETURN_NONE's purpose obsolete.)
Finally, the running condition of first 'while' loop in
maybe_call_line_trace() should not be 'size>=0' but
'size>0'. Just ask and I will submit a patch for all this.
Also, I don't understand yet why it stops twice on the first
line after a 'pdb.run("import spam")'. In Python 2.1 it also
stops an extra time but first on line number 0, which is
slightly less disturbing -- but it stops twice on the 'while
0'. Go figure. |
|
Date |
User |
Action |
Args |
2007-08-23 15:14:20 | admin | link | issue587993 messages |
2007-08-23 15:14:20 | admin | create | |
|