Open
Description
Bug Report
mypy infers Any
for several numpy expressions after upgrading to numpy==2.2.2
See also
- TYP:
np.maximum(np.array(1), np.array(1))
isAny
in 2.2.2 while it wasn't in 2.2.1 numpy/numpy#28193 - TYP:
np.mod(npt.NDArray, Any)
isAny
in 2.2.2 while it wasn't in 2.2.1 numpy/numpy#28192 - TYP: Fix overlapping overloads issue in 2->1 ufuncs numpy/numpy#28176
To Reproduce
from typing import reveal_type
import numpy as np
reveal_type(np.maximum(np.array(1), np.array(1)))
Expected Behavior
ndarray[tuple[int, ...], dtype[Any]]
Actual Behavior
Any
Your Environment
This works with numpy==2.2.1
; also, it works with pyright
. So it seems to be specific to numpy==2.2.2
and mypy
.
- Mypy version used: mypy 1.14.1 (compiled: yes)
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.13.1
Metadata
Metadata
Assignees
Labels
mypy got something wrongmypy got something wrong