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

Skip to content

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