Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore trailing quotes for unclosed l-brace errors #9388

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Given:

F"{"ڤ

We try to locate the "unclosed left brace" error by subtracting the quote size from the lexer offset -- so we subtract 1 from the end of the source, which puts us in the middle of a Unicode character. I don't think we should try to adjust the offset in this way, since there can be content after the quote. For example, with the advent of PEP 701, this string could reasonably be fixed as:

F"{"ڤ"}"

Closes #9379.

Copy link
Contributor

github-actions bot commented Jan 4, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@charliermarsh charliermarsh marked this pull request as ready for review January 4, 2024 04:55
@charliermarsh charliermarsh enabled auto-merge (squash) January 4, 2024 04:55
@charliermarsh charliermarsh merged commit f0d43da into main Jan 4, 2024
16 checks passed
@charliermarsh charliermarsh deleted the charlie/f-string-err branch January 4, 2024 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linter panic: f-string error location miscomputation
1 participant