Skip to content

(🐞) Protocol not understood as an ABCMeta #17968

Open
@KotlinIsland

Description

@KotlinIsland
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-runtime-semanticsmypy doesn't model runtime semantics correctly

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions