Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

charris
Copy link
Member

@charris charris commented Jan 17, 2025

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

@charris charris added 08 - Backport Used to tag backport PRs 41 - Static typing labels Jan 17, 2025
@charris charris added this to the 2.2.2 release milestone Jan 17, 2025
@charris charris merged commit e4517a8 into numpy:maintenance/2.2.x Jan 17, 2025
68 checks passed
@charris charris deleted the backport-28168 branch January 17, 2025 22:25
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