This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients Delengowski, eric.smith, lys.nikolaou, pablogsal
Date 2022-01-05.11:29:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641382165.52.0.35997828488.issue46260@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2022-01-05 11:29:25eric.smithsetrecipients: + eric.smith, lys.nikolaou, pablogsal, Delengowski
2022-01-05 11:29:25eric.smithsetmessageid: <1641382165.52.0.35997828488.issue46260@roundup.psfhosted.org>
2022-01-05 11:29:25eric.smithlinkissue46260 messages
2022-01-05 11:29:25eric.smithcreate