Skip to content

Commit 7a92139

Browse files
sebergkgryte
andauthored
API: Specify that DLPack should use BufferError (#498)
* API: Specify that DLPack should use BufferError I would actually like MUST, but since most implementations currently don't actually give a ``BufferError``, writing it as SHOULD instead. First part of closing numpy/numpy#20742 * Fix duplicated word Co-authored-by: Sebastian Berg <[email protected]> Co-authored-by: Athan <[email protected]>
1 parent 2024bd1 commit 7a92139

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: spec/API_specification/array_api/array_object.py

+9
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,15 @@ def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> P
290290
-------
291291
capsule: PyCapsule
292292
a DLPack capsule for the array. See :ref:`data-interchange` for details.
293+
294+
Raises
295+
------
296+
BufferError
297+
Implementations should raise ``BufferError`` when the data cannot
298+
be exported as DLPack (e.g., incompatible dtype or strides). Other
299+
errors are raised when export fails for other reasons (e.g., incorrect
300+
arguments passed or out of memory).
301+
293302
"""
294303

295304
def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:

0 commit comments

Comments
 (0)