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 UP028 false negatives with non-reference shadowed bindings of loop variables #13504

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Sep 24, 2024

Closes #13266

Avoids false negatives for shadowed bindings that aren't actually references to the loop variable. There are some shadowed bindings we need to support still, e.g., del requires the loop variable to exist.

@zanieb zanieb added the bug Something isn't working label Sep 24, 2024
Copy link
Contributor

github-actions bot commented Sep 24, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@zanieb zanieb force-pushed the zb/up028-shadow branch 3 times, most recently from f4e68c4 to 0a0b4f5 Compare September 24, 2024 16:17
@zanieb zanieb marked this pull request as ready for review September 24, 2024 16:17
@zanieb zanieb changed the title Avoid reading shadowed bindings of loop variables when considering if UP028 is safe Avoid reading non-reference shadowed bindings of loop variables when considering if UP028 is safe Sep 24, 2024
@zanieb zanieb changed the title Avoid reading non-reference shadowed bindings of loop variables when considering if UP028 is safe Avoid UP028 false negatives with non-reference shadowed bindings of loop variables Sep 24, 2024
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good to me but I also know very little about our bindings infrastructure.

@zanieb zanieb merged commit 4810652 into main Sep 25, 2024
20 checks passed
@zanieb zanieb deleted the zb/up028-shadow branch September 25, 2024 15:03
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.

UP028 for multiple loops does not work
2 participants