I declare a variable type and get assignment error for gzip.open but not for open,
To Reproduce
from collections.abc import Callable
from typing import IO
import gzip
foo : Callable[[str, str], IO] = gzip.open
Expected Behavior
no diagnostics
Actual Behavior
error: Incompatible types in assignment (expression has type overloaded function, variable has type "Callable[[str, str], IO[Any]]") [assignment]
but no diagnostics for
from collections.abc import Callable
from typing import IO
foo : Callable[[str, str], IO] = open
Your Environment
- Mypy version used:
mypy 2.3.0
- Mypy command-line flags:
--check-untyped-defs
- Python version used:
3.14.6
I declare a variable type and get assignment error for
gzip.openbut not foropen,To Reproduce
Expected Behavior
no diagnostics
Actual Behavior
but no diagnostics for
Your Environment
mypy 2.3.0--check-untyped-defs3.14.6