New submission from Erik Cederstrand <[email protected]>:
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
----------
messages: 357777
nosy: Erik Cederstrand
priority: normal
severity: normal
status: open
title: Output of syntax error in f-string contains wrong filename
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38964>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com