RustPython/Parser

Incorrect f-string parsing

charliermarsh opened this issue · 1 comments

Originally reported as astral-sh/ruff#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

I'll look into StringParser.parse_fstring.