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 Erik Cederstrand
Recipients Erik Cederstrand
Date 2019-12-04.08:27:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1575448073.72.0.500810200955.issue38964@roundup.psfhosted.org>
In-reply-to
Content
When I have a normal syntax error in a file, Python reports the filename in the exception output:

$ cat syntax_error.py 
0x=5

$ python3.8 syntax_error.py 
  File "syntax_error.py", line 1
    0x=5
     ^
SyntaxError: invalid hexadecimal literal


But if the syntax error is inside an f-string, Python reports 'File "<fstring>"' instead of the actual filename in the exception output.

$ cat syntax_error_in_fstring.py 
f'This is a syntax error: {0x=5}'

$ python3.8 syntax_error_in_fstring.py 
  File "<fstring>", line 1
SyntaxError: invalid hexadecimal literal
History
Date User Action Args
2019-12-04 08:27:53Erik Cederstrandsetrecipients: + Erik Cederstrand
2019-12-04 08:27:53Erik Cederstrandsetmessageid: <1575448073.72.0.500810200955.issue38964@roundup.psfhosted.org>
2019-12-04 08:27:53Erik Cederstrandlinkissue38964 messages
2019-12-04 08:27:53Erik Cederstrandcreate