New submission from Lysandros Nikolaou <lisandros...@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 <rep...@bugs.python.org> <https://bugs.python.org/issue41084> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com