Skip to content

FIX: remove __array__ method on BasicUnit #28744

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tacaswell
Copy link
Member

The presence of this method causes the numpy float mul to use it in numpy 2.1 which results in the units not being tagged as expected and the example failing.

PR summary

PR checklist

The presence of this method causes the numpy float __mul__ to use it
in numpy 2.1 which results in the units not being tagged as expected and
the example failing.
@tacaswell tacaswell added this to the v3.9-doc milestone Aug 21, 2024
@github-actions github-actions bot added the Documentation: examples files in galleries/examples label Aug 21, 2024
@tacaswell
Copy link
Member Author

Sorry, I did this a while ago but forgot to actually open the PR!

Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

This breaks the docs with NumPy 2.0.1.

@QuLogic
Copy link
Member

QuLogic commented Aug 21, 2024

So the bisect points this to numpy/numpy@682cd04 via numpy/numpy#26904.

Reading through the array API docs, it seems like setting __array_priority__ higher (default is 0) may also work, in order to ensure that our __array_wrap__ method is called regardless of version, and we don't end up with a bare array. Alternatively, we could implement __array_ufunc and/or __array_function__.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants