Skip to content

Commit 75b8c59

Browse files
committed
MAINT: delegate to numpy for __buffer__ and __release_buffer__
1 parent 2855133 commit 75b8c59

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

array_api_strict/_array_object.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ def __repr__(self) -> str:
167167
def __buffer__(self, flags):
168168
if self._device != CPU_DEVICE:
169169
raise RuntimeError(f"Can not convert array on the '{self._device}' device to a Numpy array.")
170-
return memoryview(self._array)
170+
return self._array.__buffer__(flags)
171+
171172
def __release_buffer__(self, buffer):
172-
# XXX anything to do here?
173-
pass
173+
self._array.__release_buffer__()
174174

175175
def __array__(self, *args, **kwds):
176176
# a stub for python < 3.12; otherwise numpy silently produces object arrays

0 commit comments

Comments
 (0)