-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
An abstract class fits the typing for Callable.
To Reproduce
import abc
from typing import Callable
class A(abc.ABC):
@abc.abstractmethod
def m(self) -> None:
...
class C(A):
def m(self) -> None:
pass
def f() -> A:
return C()
def t(x: Callable[[], A]) -> None:
x()
def main() -> None:
t(f)
t(C)
t(A) # should give typing error - A is not callable because it can't be instantiated
A() # mypy correctly reports that A can't be instantiated
if __name__ == "__main__":
main()Expected Behavior
mypy should report a typing error if an abstract class is put where a Callable should go
Actual Behavior
mypy doesn't report any error if an abstract class is put where a Callable should go
Your Environment
- Mypy version used: 0.910
- Python version used: 3.8.10
edaqa-uncountablewxgeo
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong