New submission from Maciej Górski <macg...@gmail.com>: 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. ---------- components: Parser messages: 416069 nosy: lys.nikolaou, macgors, pablogsal priority: normal severity: normal status: open title: Improve errors messages in f-string syntax errors _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue47129> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com