Skip to content

Protocol requires __slots__ to be explicitly typed #7290

Closed
@matthewvalentine

Description

@matthewvalentine

Bug report. Mypy version: mypy 0.730+dev.445020f0ed9939b43371edbddcf5b083a706d6d8

Code:

class A(Protocol):
    __slots__ = ()

Expected:

Passes, and __slots__ is not part of the Protocol interface. It's just being provided to prevent subclasses from being forced to have a __dict__.

Actual:

error: All protocol members must have explicitly declared types

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions