8000 BUG: Allow ``None`` as ``api_version`` in ``__array_namespace__`` method by mtsokol · Pull Request #25595 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Allow None as api_version in __array_namespace__ method #25595

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

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

mtsokol
Copy link
Member
@mtsokol mtsokol commented Jan 16, 2024

Hi @rgommers,

This bugfix PR updates ndarray.__array_namespace__ implementation so:

x.__array_namespace__(api_version=None)

is now allowed, as stated in the standard.

@mtsokol mtsokol self-assigned this Jan 16, 2024
@mtsokol mtsokol changed the title FIX: Allow None as api_version in __array_namespace__ function FIX: Allow None as api_version in __array_namespace__ method Jan 16, 2024
@charris charris changed the title FIX: Allow None as api_version in __array_namespace__ method FIX: Allow None as api_version in __array_namespace__ method Jan 16, 2024
@charris charris changed the title FIX: Allow None as api_version in __array_namespace__ method BUG: Allow None as api_version in __array_namespace__ method Jan 16, 2024
@rgommers rgommers added this to the 2.0.0 release milestone Jan 17, 2024
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.

Thanks @mtsokol. LGTM module one minor thing

{
PyErr_Format(PyExc_ValueError,
"Only None and strings are allowed as the Array API version.",
array_api_version);
Copy link
Member

Choose a reason for hiding this comment

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

minor: this looks like a leftover. you can either remove it, or add something like ", but received ...".

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I added array_api_version to the error message.

@mtsokol mtsokol force-pushed the fix-array-namespace-none branch from 7518655 to 5275d9b Compare January 18, 2024 10:41
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.

8000

Thanks Mateusz!

@rgommers rgommers merged commit 5feea41 into numpy:main Jan 18, 2024
@mtsokol mtsokol deleted the fix-array-namespace-none branch January 18, 2024 12:34
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
0