Skip to content

Commit db62361

Browse files
committed
astype with copy=False
1 parent 57ac5cb commit db62361

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/zarr/codecs/_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async def _encode_single(
6969
chunk = chunk_array.as_ndarray_like()
7070

7171
# ensure contiguous and correct order
72-
chunk = chunk.astype(chunk_spec.dtype, order=chunk_spec.order)
72+
chunk = chunk.astype(chunk_spec.dtype, order=chunk_spec.order, copy=False)
7373

7474
# apply filters
7575
if self.filters:

src/zarr/core/buffer/core.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ def reshape(
8080

8181
def view(self, dtype: npt.DTypeLike) -> Self: ...
8282

83-
def astype(self, dtype: npt.DTypeLike, order: Literal["K", "A", "C", "F"] = ...) -> Self: ...
83+
def astype(
84+
self,
85+
dtype: npt.DTypeLike,
86+
order: Literal["K", "A", "C", "F"] = ...,
87+
*,
88+
copy: bool = ...,
89+
) -> Self: ...
8490

8591
def fill(self, value: Any) -> None: ...
8692

0 commit comments

Comments
 (0)