Skip to content

Commit 2db4743

Browse files
committed
Replace __cuda_stream__ AttributeError with TypeError
1 parent be3c43e commit 2db4743

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cuda_core/cuda/core/experimental/_stream.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,14 @@ def _init(obj=None, *, options: Optional[StreamOptions] = None):
9090
if obj is not None:
9191
try:
9292
info = obj.__cuda_stream__()
93+
except AttributeError as e:
94+
raise TypeError(f"{type(obj)} object does not have a '__cuda_stream__' method") from e
9395
except TypeError:
9496
info = obj.__cuda_stream__
9597
warnings.simplefilter("once", DeprecationWarning)
9698
warnings.warn(
9799
"Implementing __cuda_stream__ as an attribute is deprecated; it must be implemented as a method",
100+
stacklevel=3,
98101
category=DeprecationWarning,
99102
)
100103

0 commit comments

Comments
 (0)