Skip to content

TYP: ix_ shape-typing and fix for boolean input#31218

Merged
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/ix_
Apr 11, 2026
Merged

TYP: ix_ shape-typing and fix for boolean input#31218
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/ix_

Conversation

@jorenham
Copy link
Copy Markdown
Member

@jorenham jorenham commented Apr 11, 2026

Calling np.ix_ with N arrays returns an N-tuple of N-d arrays with same dtype as input, except in case of bool, because that is upcasted to int_. This exception is what wasn't correct before, because bool input were annotated to return bool output.

Since this boolean behavior is also mentioned in the docs, I'm thinking of partially backporting this.

AI Disclosure

N/A

@jorenham jorenham added 09 - Backport-Candidate PRs tagged should be backported 41 - Static typing labels Apr 11, 2026
@jorenham jorenham added this to the 2.5.0 Release milestone Apr 11, 2026
@charris charris merged commit b5b3bab into numpy:main Apr 11, 2026
15 checks passed
@charris
Copy link
Copy Markdown
Member

charris commented Apr 11, 2026

Thanks Joren.

@jorenham jorenham deleted the typing/ix_ branch April 11, 2026 16:12
charris added a commit that referenced this pull request Apr 12, 2026
TYP: ``ix_`` fix for boolean and non-1d input (#31218)
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Apr 25, 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