[issue46260] Misleading SyntaxError on f-string

Eric V. Smith report at bugs.python.org
Tue Jan 4 18:17:51 EST 2022


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

Simpler reproducer:

>>> f"{foo)"
  File "<stdin>", line 1
    f"{foo)"
            ^
SyntaxError: f-string: unmatched ')'

I assume this is the same error as:

>>> foo)
  File "<stdin>", line 1
    foo)
       ^
SyntaxError: unmatched ')'

But I don't yet understand why it's choosing to parse that expression fragment. I'm working on it.

----------

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


More information about the Python-bugs-list mailing list