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.__array__ for numpy 2.1 #2106

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,23 @@ Release notes
2.18.3
------

Enhancements
~~~~~~~~~~~~
* Added support for creating a copy of data when converting a `zarr.Array`
to a numpy array.
By :user:`David Stansby <dstansby>`

Maintenance
~~~~~~~~~~~
* Removed support for Python 3.9.
By :user:`David Stansby <dstansby>`

* Fix a regression when using orthogonal indexing with a scalar.
By :user:`Deepak Cherian <dcherian>` :issue:`1931`

* Added compatibility with numpy 2.1.
By :user:`David Stansby <dstansby>`


.. _release_2.18.2:

Expand Down
7 changes: 2 additions & 5 deletions zarr/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,8 @@ def __eq__(self, other):
# store comparison
)

def __array__(self, *args):
a = self[...]
if args:
a = a.astype(args[0])
return a
def __array__(self, dtype=None, copy=None):
return np.array(self[...], dtype=dtype, copy=copy)

def islice(self, start=None, end=None):
"""
Expand Down
Loading