Skip to content

[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

@AlexWaygood

Description

@AlexWaygood

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).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglinterRelated to the linter

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions