This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Shannon
Recipients Anthony Sottile, Mark.Shannon, nedbat, pablogsal
Date 2021-04-26.12:31:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619440263.73.0.986991972188.issue43933@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-04-26 12:31:03Mark.Shannonsetrecipients: + Mark.Shannon, nedbat, Anthony Sottile, pablogsal
2021-04-26 12:31:03Mark.Shannonsetmessageid: <1619440263.73.0.986991972188.issue43933@roundup.psfhosted.org>
2021-04-26 12:31:03Mark.Shannonlinkissue43933 messages
2021-04-26 12:31:03Mark.Shannoncreate