Skip to content

Commit 6b81b50

Browse files
authored
cuda.core: raise BufferError instead of RuntimeError in check_has_dlpack (#2160)
1 parent ff05890 commit 6b81b50

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cuda_core/cuda/core/_memoryview.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ cdef bint check_has_dlpack(obj) except*:
996996
elif hasattr(obj, "__cuda_array_interface__"):
997997
has_dlpack = False
998998
else:
999-
raise RuntimeError(
999+
raise BufferError(
10001000
"the input object does not support any data exchange protocol")
10011001
return has_dlpack
10021002

cuda_core/tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ def test_check_has_dlpack_plain_object_raises():
10441044
class _NoProto:
10451045
pass
10461046

1047-
with pytest.raises(RuntimeError, match="does not support any data exchange protocol"):
1047+
with pytest.raises(BufferError, match="does not support any data exchange protocol"):
10481048
StridedMemoryView.from_any_interface(_NoProto(), stream_ptr=-1)
10491049

10501050

0 commit comments

Comments
 (0)