You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TYP: np.maximum(np.array(1), np.array(1)) is Any in 2.2.2 while it wasn't in 2.2.1 #28193
numpy 2.2.2 reveals a different type for np.maximum(np.array(1), np.array(1)) than 2.2.1. This looks like a result of #28176. In contrast to #28192, which I think may be intended, I think this is unintended behavior.
I think this is actually the same underlying problem as #28192, because
reveal_type(np.array(1))
is reported as
Revealed type is "ndarray[tuple[int, ...], dtype[Any]]"
Note that both np.maximum and the np.mod from #28192 are instances of the same (type-check-only) _UFunc_Nin2_Nout type.
The 0-d arrays are not scalars, so the first _UFunc_Nin2_Nout.__call__ overload also isn't relevant. And just like in #28192, it's only mypy that infers Any, and pyright reports the following:
Type of "np.maximum(np.array(1), np.array(1))" is "ndarray[tuple[int, ...], dtype[Any]]"
Activity
jorenham commentedon Jan 20, 2025
I think this is actually the same underlying problem as #28192, because
is reported as
Note that both
np.maximumand thenp.modfrom #28192 are instances of the same (type-check-only)_UFunc_Nin2_Nouttype.The 0-d arrays are not scalars, so the first
_UFunc_Nin2_Nout.__call__overload also isn't relevant. And just like in #28192, it's only mypy that infersAny, and pyright reports the following:np.mod(npt.NDArray, Any)isAnyin 2.2.2 while it wasn't in 2.2.1 #28192bersbersbers commentedon Jan 21, 2025
I opened python/mypy#18496.