Mark Shannon <m...@hotpy.org> added the comment:

In this case, if happens that line 10 was the last line of code executing in 
the body of the with statement.
But the reason it was listed, was that it was statically the last line of code 
in the body.

If the body is something like:

1. if TRUE:
2.     ...
3. else:
4.     ...

Then the reported last line will be 4, even though it is never executed.
We can fix this, at the cost of extra compiler complexity and increased 
bytecode size for the non-exceptional case, but it is very difficult for the 
exceptional case, because we don't know statically where the exception has come 
from.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43933>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to