-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
isinstance(value, Callable)
is flagged as an error
#14928
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
Labels
bug
mypy got something wrong
Comments
isinstance(value, Callable
is flagged as an errorisinstance(value, Callable)
is flagged as an error
mthuurne
added a commit
to ProtixIT/django-model-utils
that referenced
this issue
Mar 20, 2023
This is slightly more compact, but the main motivation is to work around the following mypy bug: python/mypy#14928
Duplicate of #3060 |
mthuurne
added a commit
to ProtixIT/django-model-utils
that referenced
this issue
Mar 21, 2023
This is slightly more compact, but the main motivation is to work around the following mypy bug: python/mypy#14928
JayBazuzi
added a commit
to approvals/ApprovalTests.Python
that referenced
this issue
May 5, 2025
This works around a mypy limitation. See python/mypy#14928 and python/mypy#3060
JayBazuzi
added a commit
to approvals/ApprovalTests.Python
that referenced
this issue
May 5, 2025
This works around a mypy limitation. See python/mypy#14928 and python/mypy#3060
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
When using
isinstance(value, Callable)
, mypy flags it as an error, claiming thatCallable
is a typing special form. While it is an error to use a specialized form ofCallable
such asCallable[[int], str]
, the generic class is valid forisinstance
checks.To Reproduce
Run mypy on the following code: (playground)
I also tried importing
Callable
fromtyping
instead ofcollections.abc
, but that doesn't make a difference.Expected Behavior
No error is reported, as this construct executes fine and does what is expected: checking whether the object is callable.
Actual Behavior
Your Environment
The text was updated successfully, but these errors were encountered: