Skip to content

Commit bf3c713

Browse files
committed
No need to take unsigned bytes view following zarr-developers#2738
1 parent 94e693e commit bf3c713

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/zarr/core/buffer/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def as_bytes_like(self) -> BytesLike:
266266
-------
267267
A bytes-like object that implements the Python buffer protocol
268268
"""
269-
return memoryview(self.as_numpy_array().view(np.uint8)) # type: ignore[arg-type]
269+
return memoryview(self.as_numpy_array()) # type: ignore[arg-type]
270270

271271
def to_bytes(self) -> bytes:
272272
"""Returns the buffer as `bytes` (host memory).

src/zarr/storage/_local.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def _put(
5252
with path.open("r+b") as f:
5353
f.seek(start)
5454
# write takes any object supporting the buffer protocol
55-
f.write(value.as_numpy_array()) # type: ignore[arg-type]
55+
f.write(value.as_bytes_like())
5656
return None
5757
else:
58-
view = memoryview(value.as_numpy_array()) # type: ignore[arg-type]
58+
view = value.as_bytes_like()
5959
if exclusive:
6060
mode = "xb"
6161
else:

0 commit comments

Comments
 (0)