[issue28121] If module starts with comment or empty line then frame.f_code.co_firstlineno is inconsistent with inspect.findsource
Aivar Annamaa
report at bugs.python.org
Thu Feb 23 04:38:54 EST 2017
Aivar Annamaa added the comment:
Looks like I misinderstood inspect.findsource. I thought it is supposed to give only the code for argument object (eg. only def code when given a function), but looks like it is giving the whole file.
Unfortunately inspect.findsource is not documented in https://docs.python.org/3/library/inspect.html and inspect.getsource can't be used as replacement, because it doesn't work with modules.
----------
stage: -> resolved
status: open -> closed
versions: +Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28121>
_______________________________________
More information about the Python-bugs-list
mailing list