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 iritkatriel
Recipients iritkatriel, remi.lapeyre, timofej, zach.ware
Date 2020-09-24.23:01:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600988513.06.0.0587828137584.issue40813@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-09-24 23:01:53iritkatrielsetrecipients: + iritkatriel, zach.ware, remi.lapeyre, timofej
2020-09-24 23:01:53iritkatrielsetmessageid: <1600988513.06.0.0587828137584.issue40813@roundup.psfhosted.org>
2020-09-24 23:01:53iritkatriellinkissue40813 messages
2020-09-24 23:01:52iritkatrielcreate