This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author remi.lapeyre
Recipients remi.lapeyre, timofej, zach.ware
Date 2020-05-29.14:43:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590763400.32.0.769986654169.issue40813@roundup.psfhosted.org>
In-reply-to
Content
Indeed, the exception has the correct line number when compiling manually:


>>> try:
...     compile('if __name__ == "__main__":\n   print("hello world"\n', '<string>', 'exec')
... except SyntaxError as e:
...     print(e.lineno)
...
2


but not when running `python3 main.py`:
  File "main.py", line 3

                          ^
SyntaxError: unexpected EOF while parsing



I tried with all version of Python >= 3.6 and Python2 and they all exhibit the same behavior.
History
Date User Action Args
2020-05-29 14:43:20remi.lapeyresetrecipients: + remi.lapeyre, zach.ware, timofej
2020-05-29 14:43:20remi.lapeyresetmessageid: <1590763400.32.0.769986654169.issue40813@roundup.psfhosted.org>
2020-05-29 14:43:20remi.lapeyrelinkissue40813 messages
2020-05-29 14:43:20remi.lapeyrecreate