Amaury Forgeot d'Arc added the comment:

Here is an attempt to correct the problem, with unit tests.

I removed half of the trick marked by a "XXX(nnorwitz)", by adding an
attribute to "struct instr" (this attribute is a bitfield and does not
increase the memory usage). FOR_ITER is no more special-cased in
assemble_lnotab.
Note that the attribute is not always set: only when the target block
has already been filled with instructions. Hopefully this is the case
for the beginning of loops (while & for).

Then the second part of the trick (c->u->u_lineno_set = false, already
used in compiler_for) can be applied to compiler_while. Don't know how
to write this better.

Nir's examples now correctly generate the 3 offsets, and the unit test
checks that a "line" event is repeatedly emitted for the "while" condition.

----------
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file9319/while_lnotab.patch

_____________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1750076>
_____________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to