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 gvanrossum
Recipients gvanrossum
Date 2020-05-14.03:57:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589428650.19.0.472919567451.issue40619@roundup.psfhosted.org>
In-reply-to
Content
Example:

>>> compile("pass\n(1+)\npass", "<string>", "exec")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 2
    (1+)
pass
       ^
SyntaxError: invalid syntax
>>> 

Note that the input is

pass
(1+)
pass

The second "pass" (and in fact the entire file) leaks into the SyntaxError object's text attribute.

This only happens when the file (here "<string>") cannot be read.

It's not specific to compile(), it seems fundamental in the C-level pegen API.
History
Date User Action Args
2020-05-14 03:57:30gvanrossumsetrecipients: + gvanrossum
2020-05-14 03:57:30gvanrossumsetmessageid: <1589428650.19.0.472919567451.issue40619@roundup.psfhosted.org>
2020-05-14 03:57:30gvanrossumlinkissue40619 messages
2020-05-14 03:57:29gvanrossumcreate