Open
Description
Bug Report
isinstance(_, collections.abc.Callable)
is allowed at runtime, but is reported
(A clear and concise description of what the bug is.)
To Reproduce
from collections.abc import Callable
assert isinstance(int, Callable)
Expected Behavior
for isinstance(_, collections.abc.Callable)
to behave identically to callable(_)
:
- no error
_: T
is narrowed to_: <callable subtype of T>
Actual Behavior
main.py:2: error: Argument 2 to "isinstance" has incompatible type "<typing special form>"; expected "_ClassInfo" [arg-type]
https://mypy-play.net/?mypy=latest&python=3.13&gist=463e1edfbfc8cefc268fce8544b0b49b