Closed
Description
Zarr version
v2.18.0
Numcodecs version
0.12.1
Python Version
3.12
Operating System
Windows
Installation
via poetry install
Description
There seems to be a regression in v2.18.0 (compared to v2.17.2) concerning setting items in an object array.
Steps to reproduce
Setup:
import zarr
from numcodecs import MsgPack
import numpy as np
root = zarr.group()
arr = root.create_dataset(
name="my_dataset",
shape=0,
dtype=object,
object_codec=MsgPack(),
)
new_items = [
["A", 1],
["B", 2, "hello"],
]
arr_add = np.empty(len(new_items), dtype=object)
arr_add[:] = new_items
arr.append(arr_add)
arr[:] # --> array([list(['A', 1]), list(['B', 2, 'hello'])], dtype=object)
Problem:
arr[0] = ["C", 3] # raises AttributeError: 'list' object has no attribute 'astype' (from Array._process_for_setitem)
Using Zarr v2.17.2, no such exception is raised, and the first item is successfully modified.
Additional output
No response