Setting frame.f_lineno raises spurious SystemErrors

Create issue
Issue #3066 resolved
Ronan Lamy created an issue

See test_f_lineno_set_4() in The core issue is that POP_BLOCK/END_FINALLY opcodes can disappear if they happen to be in dead code, i.e. if there is an unconditional return in the block they end. In such a case, PyFrame.fset_f_lineno considers the bytecode invalid and raises a SystemError.

Comments (2)

  1. Armin Rigo

    Fixed at least this particular problem in 68e1f1bd6ea6 by not removing dead bytecode ( removes bytecodes that follow a "return", and that's it, which doesn't sound extremely useful anyway).

  2. Armin Rigo

    Oh, never mind. Turns out that the change to was not needed after all (the test appears fixed by only the previous checkins). Reverted.

  3. Log in to comment