[issue38283] sys._getframe(1).f_lineno changed behavior in 3.8

Serhiy Storchaka report at bugs.python.org
Thu Sep 26 11:01:17 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

No, I do not know such workaround. At best, you can analyze the code object and get the line number of the next instruction. It may be the line past the last line of the function call, or be equal to it if the function call is the part of complex expression or if you write several statements on the line. Then you need to analyze the sources.

The information about the first line of the multiline expression looks more useful than information about the last line. And it is more consistent with other cases. Maybe in future we will add information about the range of lines for every expression and statement (some steps was already made in this direction). But this is more complex change.

----------

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


More information about the Python-bugs-list mailing list