Skip to content

TYP: fix ma.count_masked return type when out=None (default) - #31920

Merged
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/ma.count_masked-axis=None
Jul 8, 2026
Merged

charris merged 1 commit into
numpy:mainfrom
jorenham:typing/ma.count_masked-axis=None

Conversation

@jorenham

@jorenham jorenham commented Jul 8, 2026

Copy link
Copy Markdown
Member

np.ma.count_masked with axis=None (the default) returns a bare np.intp at runtime, but the stubs incorrectly used NDArray[np.intp] as output type in that case.


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

(only a couple of stub fixes left now)

@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 6f291ec 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.count_masked-axis=None branch July 8, 2026 13:29
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label 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