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

Avoid off-by-one error in with-item named expressions #8915

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

charliermarsh
Copy link
Member

Summary

Given with (a := b): pass, we truncate the WithItem range by one on both sides such that the parentheses are part of the statement, rather than the item. However, for with (a := b) as x: pass, we want to avoid this trick.

Closes #8913.

@charliermarsh charliermarsh added bug Something isn't working parser Related to the parser labels Nov 30, 2023
@charliermarsh charliermarsh enabled auto-merge (squash) November 30, 2023 00:10
@charliermarsh charliermarsh merged commit 774c77a into main Nov 30, 2023
16 checks passed
@charliermarsh charliermarsh deleted the charlie/with branch November 30, 2023 00:11
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser Related to the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect range for WithItem node
2 participants