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

[v0.3.3 regression]: F811 incorrectly emitted if a symbol in a stub is re-exported and a symbol by the same name is defined in a different scope #10509

Closed
AlexWaygood opened this issue Mar 21, 2024 · 0 comments · Fixed by #10512
Assignees
Labels
bug Something isn't working linter Related to the linter

Comments

@AlexWaygood
Copy link
Member

Starting in v0.3.3, Ruff incorrectly emits F811 on this snippet if it's a .pyi file:

from foo import Bar as Bar

class Eggs:
    Bar: int  # F811 Redefinition of unused `Bar` from line 1

This shouldn't be flagged as a redefinition, as the Eggs.Bar variable is being defined in a different scope to the global Bar variable, which is being re-exported from the module. The regression bisects to 4b06669 (by me).

@AlexWaygood AlexWaygood added bug Something isn't working linter Related to the linter labels Mar 21, 2024
charliermarsh added a commit that referenced this issue Mar 21, 2024
## Summary

In #10341, we fixed some false
positives in `.pyi` files, but introduced others. This PR effectively
reverts the change in #10341 and fixes it in a slightly different way.
Instead of changing the _bindings_ we generate in the semantic model in
`.pyi` files, we instead change how we _resolve_ them.

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

Successfully merging a pull request may close this issue.

2 participants