We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
isinstance(_, Callable)
[arg-type]
Bug Report
isinstance(_, collections.abc.Callable) is allowed at runtime, but is reported
isinstance(_, collections.abc.Callable)
(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(_):
callable(_)
_: T
_: <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
The text was updated successfully, but these errors were encountered:
As a work around the callable builtin narrows. (You're probably aware though)
callable
Sorry, something went wrong.
I'm indeed aware, but others might not, so it's good that you mention it 👍🏻
No branches or pull requests
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
Expected Behavior
for
isinstance(_, collections.abc.Callable)
to behave identically tocallable(_)
:_: T
is narrowed to_: <callable subtype of T>
Actual Behavior
https://mypy-play.net/?mypy=latest&python=3.13&gist=463e1edfbfc8cefc268fce8544b0b49b
The text was updated successfully, but these errors were encountered: