Skip to content

Warn when a base class has type Any due to --silent-imports #1374

Closed
@gvanrossum

Description

@gvanrossum

Sometimes, --silent-imports prevents importing a module that defines the base class for some other class. The other class then implicitly inherits from Any, and this means that many operations on the instances of that class are not type-checked at all. I just fixed (#1365) an issue where something was type-checked without taking this unknown base class into account, and the result was an incorrect error. However there are also plenty of situations imaginable where this situation prevents useful type-checking from happening. So perhaps we should issue a warning in this situation (i.e. a base class being undefined due to an import being suppressed due to --silent-imports). Maybe --almost-silent could be augmented to also issue these warnings.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions