Louie Lu added the comment: 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) ---------- nosy: +louielu _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28121> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com