Skip to content

Commit 72b3b9a

Browse files
committed
handle fill_value==None
1 parent 943da8d commit 72b3b9a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/zarr/core/buffer/cpu.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ def create(
154154
order: Literal["C", "F"] = "C",
155155
fill_value: Any | None = None,
156156
) -> Self:
157-
return cls(
158-
np.full(shape=tuple(shape), fill_value=fill_value or 0, dtype=dtype, order=order)
159-
)
157+
if fill_value is None:
158+
return cls(np.zeros(shape=tuple(shape), dtype=dtype, order=order))
159+
else:
160+
return cls(np.full(shape=tuple(shape), fill_value=fill_value, dtype=dtype, order=order))
160161

161162
@classmethod
162163
def from_numpy_array(cls, array_like: npt.ArrayLike) -> Self:

0 commit comments

Comments
 (0)