Closed
Description
Zarr version
v2.18.0
Numcodecs version
v0.12.1
Python Version
3.11
Operating System
Reproduced on mac and linux
Installation
micromamba / conda-forge
Description
Indexing to unit-length arrays fails since zarr 2.18. Indexing other array lengths still works. See reproducer script and traceback below. In zarr 2.17, this still worked. I don't understand the problem exactly, but based on the 2.18 changelog, I would guess that this is somehow related to #1800
Steps to reproduce
import zarr
import numcodecs
assert zarr.__version__ == "2.18.0"
assert numcodecs.__version__ == "0.12.1"
x = zarr.array([1, 2])
y = zarr.array([1])
# OK
print(x[:])
print(y[:])
# OK
print(x[0])
# Not OK
print(y[0])
Additional output
Traceback (most recent call last):
File "/Users/x/Library/Application Support/JetBrains/PyCharm2023.3/scratches/scratch_42.py", line 14, in <module>
print(x[0])
~^^^
File "/Users/x/micromamba/envs/envname/lib/python3.11/site-packages/zarr/core.py", line 800, in __getitem__
result = self.get_basic_selection(pure_selection, fields=fields)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/x/micromamba/envs/envname/lib/python3.11/site-packages/zarr/core.py", line 926, in get_basic_selection
return self._get_basic_selection_nd(selection=selection, out=out, fields=fields)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/x/micromamba/envs/envname/lib/python3.11/site-packages/zarr/core.py", line 968, in _get_basic_selection_nd
return self._get_selection(indexer=indexer, out=out, fields=fields)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/x/micromamba/envs/envname/lib/python3.11/site-packages/zarr/core.py", line 1343, in _get_selection
self._chunk_getitems(
File "/Users/x/micromamba/envs/envname/lib/python3.11/site-packages/zarr/core.py", line 2181, in _chunk_getitems
self._process_chunk(
File "/Users/x/micromamba/envs/envname/lib/python3.11/site-packages/zarr/core.py", line 2049, in _process_chunk
self._compressor.decode(cdata, dest)
File "numcodecs/blosc.pyx", line 564, in numcodecs.blosc.Blosc.decode
File "numcodecs/blosc.pyx", line 365, in numcodecs.blosc.decompress
File "numcodecs/compat_ext.pyx", line 16, in numcodecs.compat_ext.Buffer.__cinit__
ValueError: buffer source array is read-only