Eric V. Smith <e...@trueblade.com> added the comment:

In fstring_find_expr, the code[0] that's checking for parens, braces, and 
brackets detects the closing paren without a matching open paren.

The error message isn't incorrect: if you added a matching open paren the code 
would compile:
>>> foo=lambda:0
>>> f'{foo()}'
'0'

So while the error might not be intuitive, it's not wrong.

0: 
https://github.com/python/cpython/blob/cae55542d23e606dde9819d5dadd7430085fcc77/Parser/string_parser.c#L664d

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46260>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to