Skip to content

Invalid syntax error in multi-line f-string with format spec #6077

@dhruvmanila

Description

@dhruvmanila

Describe the bug

Basically the same bug as reported in CPython (python/cpython#110259) exists in Pyright's lexer as well.

Code or Screenshots

f"""__{
	a:d
}__"""

Running pyright on the above code gives:

$ pyright ~/playground/ruff/fstring.py
/Users/dhruv/playground/ruff/fstring.py
  /Users/dhruv/playground/ruff/fstring.py:3:2 - error: String literal is unterminated
  /Users/dhruv/playground/ruff/fstring.py:2:5 - error: "x" is not defined (reportUndefinedVariable)
2 errors, 0 warnings, 0 informations 

VS Code extension or command-line

Running through the command-line using 1.1.329

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions