-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-pep-585PEP 585 (builtin generics)PEP 585 (builtin generics)
Description
Bug Report
I have a protocol:
class SupportsStr(Protocol):
def __str__(self) -> str:
...
Surprisingly, builtins.type
is compliant with this, while Type[Any]
isn't.
To Reproduce
Link to mypy playground: https://mypy-play.net/?mypy=latest&python=3.11&gist=355a1b96812a523f6e374eb8ca6f4635
Expected Behavior
I would think both should be compliant, given that the typing.Type
docs states that:
Type[Any]
is equivalent to Type which in turn is equivalent to type, which is the root of Python’s metaclass hierarchy.
Actual Behavior
Surprisingly, builtins.type
is compliant with this, while Type[Any]
isn't.
Your Environment
See link to mypy playground.
Mypy 0.960 and python 3.11
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-pep-585PEP 585 (builtin generics)PEP 585 (builtin generics)