Skip to content

Allow incompatible overrides on __slots__ #833

Open
@JelleZijlstra

Description

This should be allowed:

class A:
    __slots__ = ("a",)

    def __init__(self) -> None:
        self.a = 3

class B(A):
    __slots__ = ("b",)

    def __init__(self) -> None:
        super().__init__()
        self.b = 4

But currently produces incompatible_override. Special-case __slots__ to allow this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions