[issue16956] Allow signed line number deltas in the code object's line number table

Mark Shannon report at bugs.python.org
Tue Jan 15 10:26:26 CET 2013


Mark Shannon added the comment:

The interaction between bdb/pdb and the line number table is via the frame.f_lineno attribute.

Allowing signed offsets changes the one-to-one line muber => bytecode offset relation into a one-to-many relation.

Reading frame.f_lineno is not an issue as each bytecode offset will always refer to exactly one line number.

Setting frame.f_lineno requires some thought as each line number could potentially refer to several bytecode offsets. However, the proposed patch retains the one-to-one relation, as the test in the while statement is merely moved, not duplicated.

I am reluctant to change frame_setlineno() until there really is a one-to-many relation as it will be untestable.
Once a one-to-many relation exists (e.g. duplicating finally blocks to avoid 'pseudo excpetions') then frame_setlineno should be modified (and tests added)

----------

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


More information about the Python-bugs-list mailing list