RustPython / Parser

MIT License
66 stars 24 forks source link

Incorrect f-string parsing #88

Open charliermarsh opened 1 year ago

charliermarsh commented 1 year ago

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
yt2b commented 5 months ago

I'll look into StringParser.parse_fstring.