Skip to content

TYP: Fix overlapping overloads issue in 2->1 ufuncs - #28176

Merged
charris merged 1 commit into
numpy:maintenance/2.2.xfrom
charris:backport-28168
Jan 17, 2025
Merged

charris merged 1 commit into
numpy:maintenance/2.2.xfrom
charris:backport-28168

Conversation

@charris

@charris charris commented Jan 17, 2025

Copy link
Copy Markdown
Member

Backport of #28168.

Closes #28162


before:

import numpy as np
import numpy.typing as npt

a: npt.NDArray[np.float64] | np.float64
b: npt.NDArray[np.float64] | np.float64
out = np.logical_or(a, b)
reveal_type(out)  # npt.NDArray[Any]  <-- no scalar

after:

import numpy as np
import numpy.typing as npt

a: npt.NDArray[np.float64] | np.float64
b: npt.NDArray[np.float64] | np.float64
out = np.logical_or(a, b)
reveal_type(out)  # npt.NDArray[Any] | Any

The same fix has also been applied to .outer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 - Backport Used to tag backport PRs 41 - Static typing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants