Skip to content
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

TYP: add None to __getitem__ in numpy.array_api #25022

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

Illviljan
Copy link
Contributor

@Illviljan Illviljan commented Oct 28, 2023

Add None to the getitem type hints.

The array_api site doesn't mention it in the getitem page until the draft version however:
https://data-apis.org/array-api/draft/API_specification/generated/array_api.array.__getitem__.html

But it is mentioned in the 2021.12 version in the indexing page:

Each None in the selection tuple must expand the dimensions of the resulting selection by one dimension of size 1. The position of the added dimension must be the same as the position of None in the selection tuple.
https://data-apis.org/array-api/2021.12/API_specification/indexing.html

Which of these pages takes priority?

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was recently fixed upstream, and the discussion in data-apis/array-api#674 shows that this change can be considered a minor bug fix for earlier versions of the standard. So this is good to merge as is. Thanks @Illviljan

@rgommers rgommers merged commit 3c853e1 into numpy:main Nov 13, 2023
58 checks passed
@rgommers rgommers changed the title Add None to array_api __getitem__ TYP: add None to __getitem__ in numpy.array_api Nov 13, 2023
@rgommers rgommers added this to the 2.0.0 release milestone Nov 13, 2023
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Nov 13, 2023
charris pushed a commit to charris/numpy that referenced this pull request Nov 19, 2023
@charris charris changed the title TYP: add None to __getitem__ in numpy.array_api TYP: add None to __getitem__ in numpy.array_api Nov 19, 2023
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Nov 19, 2023
charris pushed a commit to charris/numpy that referenced this pull request Nov 19, 2023
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.

BUG: array_api.Array has wrong type hints in __getitem__
4 participants