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

fix __array__wrap in DiscreteField #1147

Closed
duarte-jfs opened this issue Jul 25, 2024 · 0 comments · Fixed by #1159
Closed

fix __array__wrap in DiscreteField #1147

duarte-jfs opened this issue Jul 25, 2024 · 0 comments · Fixed by #1159

Comments

@duarte-jfs
Copy link

duarte-jfs commented Jul 25, 2024

While using numpy==2.0.0, I have noticed the deprecation warning in DiscreteField.array_wrap. In their documentation, they now enforce that the signature of array_wrap to be __array_wrap__(self, arr, context=None, return_scalar=False). Therefore I propose we change:

class DiscreteField(ndarray):
    ...

    def __array_wrap__(self, out_arr, context = None):
        # invalidate attributes after ufuncs
        return np.array(out_arr)

to:

class DiscreteField(ndarray):
    ...

    def __array_wrap__(self, out_arr, context = None, return_scalar = False):
        # invalidate attributes after ufuncs
        return np.array(out_arr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant