Issue 28121: If module starts with comment or empty line then frame.f_code.co_firstlineno is inconsistent with inspect.findsource (original) (raw)

Sorry, but I can't reproduce at 3.7, 3.5, or 2.7. the result shows me that inspect does respect comment line.

➜ cpython git:(350) ✗ ./python /tmp/main.py 2 (['# First line\n', 'import inspect\n', 'frame = inspect.currentframe()\n', 'print(frame.f_code.co_firstlineno)\n', 'print(inspect.findsource(frame.f_code))\n'], 0)

➜ /tmp python2 main.py 2 (['# First line\n', 'import inspect\n', 'frame = inspect.currentframe()\n', 'print(frame.f_code.co_firstlineno)\n', 'print(inspect.findsource(frame.f_code))\n'], 0)