Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(🐞) Protocol not understood as an ABCMeta #17968

Open
KotlinIsland opened this issue Oct 16, 2024 · 0 comments
Open

(🐞) Protocol not understood as an ABCMeta #17968

KotlinIsland opened this issue Oct 16, 2024 · 0 comments
Labels
bug mypy got something wrong topic-runtime-semantics mypy doesn't model runtime semantics correctly

Comments

@KotlinIsland
Copy link
Contributor

KotlinIsland commented Oct 16, 2024

from abc import ABC, ABCMeta
from typing import Protocol

a: ABCMeta
a = Protocol  # erm, error: "type[type]" is not assignable to "type[ABCMeta]"
a = ABC

mypy in real life

class Interface(Protocol):
    def f(self):
        print("hi")

class Data(Interface, Enum):  # runtime error: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
    a = 1
@KotlinIsland KotlinIsland added the bug mypy got something wrong label Oct 16, 2024
@hauntsaninja hauntsaninja added the topic-runtime-semantics mypy doesn't model runtime semantics correctly label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-runtime-semantics mypy doesn't model runtime semantics correctly
Projects
None yet
Development

No branches or pull requests

2 participants