Skip to content

Avoid syntax errors in RUF036 fixes#23764

Merged
charliermarsh merged 1 commit intomainfrom
charlie/pad
Mar 6, 2026
Merged

Avoid syntax errors in RUF036 fixes#23764
charliermarsh merged 1 commit intomainfrom
charlie/pad

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

Part of: #23763.

--> RUF036.py:70:7
|
69 | # Preserve token boundaries when fixing non-annotation expressions.
70 | print(None | (int)and 2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I'm surprised that the rule applies to cases outside of annotations. The docs make it sound like it only applies to annotations, which is what I always expected. Should we change that instead (or in addition)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is necessary regardless, but yeah, it should be limited to type contexts.

@charliermarsh charliermarsh marked this pull request as ready for review March 6, 2026 20:12
@astral-sh-bot astral-sh-bot bot requested a review from ntBre March 6, 2026 20:12
@charliermarsh charliermarsh added the bug Something isn't working label Mar 6, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 6, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh merged commit 0b05e45 into main Mar 6, 2026
44 checks passed
@charliermarsh charliermarsh deleted the charlie/pad branch March 6, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants