[New-bugs-announce] [issue30529] Incorrect error messages for invalid whitespaces in f-string subexpressions

Serhiy Storchaka report at bugs.python.org
Wed May 31 16:24:52 EDT 2017


New submission from Serhiy Storchaka:

Python parser supports only ' ', '\t', '\x0c' and '\r' as whitespaces. The parser of f-strings raises incorrect error messages for subexpressions consistent only from whitespaces, if they contain whitespaces out this set.

>>> eval("\xa0")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
     
    ^
SyntaxError: invalid character in identifier
>>> eval("f'''{\xa0}'''")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
SyntaxError: f-string: empty expression not allowed

----------
components: Interpreter Core
messages: 294869
nosy: eric.smith, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Incorrect error messages for invalid whitespaces in f-string subexpressions
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30529>
_______________________________________


More information about the New-bugs-announce mailing list