Commit 8d956e0
authored
## Summary
Fixes #10874.
In stub files, explicit re-exports (`from x import y as y`) at module
scope were falsely flagged as redefined (F811) by class-scoped
attributes with the same name. A class attribute binding in a nested
scope should not invalidate a module-level re-export.
Skip the F811 diagnostic when the shadowed binding is an explicit
re-export (`is_explicit_export()`).
## Test plan
- Reproduction case: `ruff check --select F811 stub.pyi` no longer emits
false positive
- `cargo test -p ruff_linter -- pyflakes` — all 462 tests pass
1 parent df7e826 commit 8d956e0
4 files changed
Lines changed: 19 additions & 0 deletions
File tree
- crates/ruff_linter
- resources/test/fixtures/pyflakes
- src/rules/pyflakes
- rules
- snapshots
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
129 | 136 | | |
130 | 137 | | |
131 | 138 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments