[issue41084] Signify that a SyntaxError comes from an fstring in the error message
Lysandros Nikolaou
report at bugs.python.org
Mon Jun 22 19:53:42 EDT 2020
New submission from Lysandros Nikolaou <lisandrosnik at gmail.com>:
It's relatively easy to identify if a SyntaxError occurs when parsing an fstring expression or not. The idea is to slightly change the error message to start with "f-string: " when it does (in the same way in which SyntaxError messages are produced by the hand-written fstring parser). I have a working PR that produces the following:
$ cat a.py
f'{a $ b}'
$ ./python.exe a.py
File "/Users/lysnikolaou/Repositories/cpython/a.py", line 1
(a $ b)
^
SyntaxError: f-string: invalid syntax
Thoughts?
----------
components: Interpreter Core
messages: 372134
nosy: eric.smith, gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Signify that a SyntaxError comes from an fstring in the error message
type: enhancement
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41084>
_______________________________________
More information about the Python-bugs-list
mailing list