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 macgors
Recipients lys.nikolaou, macgors, pablogsal
Date 2022-03-26.15:08:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648307307.69.0.710442348209.issue47129@roundup.psfhosted.org>
In-reply-to
Content
When an empty expression is provided in curly brackets inside an f-string we get Syntax Error: "f-string: empty expression not allowed".


This is correct, however error with the same message is raised in the following cases: f"{!foo}", f"{!}", f"{:bar}", f"{=}", etc.
For example, should someone make an error and try to negate an expression with '!' instead of 'not' (i.e. f"{!True}"), they would get a confusing error, saying that the expression is empty, when it isn't. 

I propose we raise an error with the message: "f-string: optional specifier '%c' must follow a non-empty expression.
History
Date User Action Args
2022-03-26 15:08:27macgorssetrecipients: + macgors, lys.nikolaou, pablogsal
2022-03-26 15:08:27macgorssetmessageid: <1648307307.69.0.710442348209.issue47129@roundup.psfhosted.org>
2022-03-26 15:08:27macgorslinkissue47129 messages
2022-03-26 15:08:27macgorscreate