Closed
Description
Bug Report
This feels related to #8869, but different enough to warrant a separate issue.
There, the issue was that a bound method of MethodType
is incorrectly rejected as a Callable, here, I'm noticing that an unbound class method is rejected as a FunctionType
:
To Reproduce
import types
class Cls:
def meth(self):
pass
assert isinstance(Cls.meth, types.FunctionType) # no problem
x: types.FunctionType = Cls.meth
Incompatible types in assignment (expression has type "Callable[[Cls], Any]", variable has type "FunctionType") [assignment]
Expected Behavior
I expected an unbound class method to work for an argument expecting FunctionType
Actual Behavior
Incompatible types in assignment
Your Environment
- mypy 0.790
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.8.6
- Operating system and version: macos 10.15.7
Additional info
(In this case, I didn't want to use x: Callable
because I'd like to be able to assert that the standard function object methods will be available)