[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
Tue Sep 13 04:38:34 EDT 2016


New submission from Aivar Annamaa:

Following program shows that frame.f_code.co_firstlineno ignores first line if it is a comment (or empty line), but inspect.getsource(frame.f_code) returns also the first line:

# first line
import inspect
frame = inspect.currentframe()
print(frame.f_code.co_firstlineno)
print(inspect.findsource(frame.f_code))

----------
messages: 276211
nosy: Aivar.Annamaa
priority: normal
severity: normal
status: open
title: If module starts with comment or empty line then frame.f_code.co_firstlineno is inconsistent with inspect.findsource

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28121>
_______________________________________


More information about the Python-bugs-list mailing list