[issue38964] Output of syntax error in f-string contains wrong filename

Eric V. Smith report at bugs.python.org
Wed Dec 4 15:05:26 EST 2019


Eric V. Smith <eric at trueblade.com> added the comment:

Yes, moving f-strings to the grammar would be a huge change, and not just for CPython.

I discussed it at the last PyCon with the authors of various editors (for syntax highlighting) and other tools that parse python code. No one was hugely opposed to it, and I think even one person was very excited about it. But it's not a step to be taken lightly. I don't think I've discussed it with any other Python implementors outside of CPython.

My biggest concern is that it makes naive string recognition fail. For example, this would become a valid f-string:
f'{fn('some string')}'
while
'{fn('some string')}'
is not a valid string.

I now I think I've completely derailed this bug report. I think the action item here is for me to finish up my better error reporting.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38964>
_______________________________________


More information about the Python-bugs-list mailing list