[issue43933] Regression in python3.10 with traceback frame having lineno of -1

Mark Shannon report at bugs.python.org
Mon Apr 26 06:16:29 EDT 2021


Mark Shannon <mark at hotpy.org> added the comment:

What exactly is the issue here?
That the line number is -1, or that is different from 3.9?

The `-1` should be `None`. I can fix that, but there is the issue of whether the cleanup code in a with statement should have a line number or not.

The traceback for 3.9 is incorrect, the program is not on line 10 when __exit__ is called.

Currently we mark the cleanup code for the with statement as artificial meaning that it has no line number.
We could give it the line number of the `with` keyword, but that might break coverage and profiling tools.

PEP 626 says that the "with" keyword is executable, and should be traced, but nothing about whether that includes the cleanup call to __exit__.

----------
nosy: +nedbat

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43933>
_______________________________________


More information about the Python-bugs-list mailing list