Parser icon indicating copy to clipboard operation
Parser copied to clipboard

Incorrect f-string parsing

Open charliermarsh opened this issue 2 years ago • 1 comments

Originally reported as https://github.com/astral-sh/ruff/issues/5044:

Not the best string ever, but ruff doesn't handle it like Python

λ cat test.py
print(f"$N_{{img}}\in\{{0,1,2\}}$")
λ python test.py
$N_{img}\in\{0,1,2\}$
λ ruff check test.py --select F401
error: Failed to parse test.py:1:25: f-string: unterminated string

charliermarsh avatar Jun 13 '23 13:06 charliermarsh

I'll look into StringParser.parse_fstring.

yt2b avatar Jan 20 '24 06:01 yt2b