Skip to content

TYP: fix single-arg ma.where return type - #31919

Merged
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/ma.where-1
Jul 8, 2026
Merged

charris merged 1 commit into
numpy:mainfrom
jorenham:typing/ma.where-1

Conversation

@jorenham

@jorenham jorenham commented Jul 8, 2026

Copy link
Copy Markdown
Member

Single-arg np.ma.where calls return a tuple of ndarray, not MaskedArray:

In [1]: np.ma.where(np.array([True, False]))
Out[1]: (array([0]),)

In [2]: np.ma.where(np.array([True, False]).view(np.ma.MaskedArray))
Out[2]: (array([0]),)

Fully written by me (a human); bug found by Claude Fable 5 (here's the full (second) audit for those interested).

(even more stub fixes on the way)

@jorenham jorenham added component: numpy.ma masked arrays 09 - Backport-Candidate PRs tagged should be backported 41 - Static typing labels Jul 8, 2026
@charris
charris merged commit aa51e50 into numpy:main Jul 8, 2026
14 checks passed
@charris

charris commented Jul 8, 2026

Copy link
Copy Markdown
Member

Thanks Joren.

@jorenham
jorenham deleted the typing/ma.where-1 branch July 8, 2026 12:44
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Jul 8, 2026
jorenham added a commit that referenced this pull request Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants