Irit Katriel <iritkatr...@yahoo.com> added the comment:
I don't think it's true that the lineno is correct when compiling a string (Remi's string is just too short): >>> try: ... compile('if __name__ == "__main__":\n print("hello world"\n x=5\n', '<string>', 'exec') ... except SyntaxError as e: ... print("e.lineno=", e.lineno) ... print("e.offset=", e.offset) ... print("e.text=", e.text) ... e.lineno= 3 e.offset= 4 e.text= x=5 >>> Arguably the syntax error is on line 3. Line 2 can be complemented by a line 3 that will make it valid. ---------- nosy: +iritkatriel _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40813> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com