Skip to content

Emit better syntax error for unicode prefix #19342

@dylwil3

Description

@dylwil3

Currently we get:

echo 'uf"a"' | ruff check --output-format concise -
-:1:3: SyntaxError: Simple statements must be separated by newlines or semicolons
Found 1 error.

but ideally we would get the more informative (as of Python 3.14):

>>> uf"a"
  File "<python-input-0>", line 1
    uf"a"
    ^^
SyntaxError: 'u' and 'f' prefixes are incompatible

and similarly for t-strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    parserRelated to the parserpython314Related to Python 3.14

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions