From b30dfb9078efe66867f3b074a8534cd1f6911e56 Mon Sep 17 00:00:00 2001 From: Iamsohungrynow <261225237+Iamsohungrynow@users.noreply.github.com> Date: Sat, 21 Nov 2026 10:53:54 +0800 Subject: [PATCH 1/2] fix(cuda.core): point the stream protocol warning at Device.create_stream Signed-off-by: Iamsohungrynow <261225237+Iamsohungrynow@users.noreply.github.com> --- cuda_core/cuda/core/_stream.pyx | 2 +- cuda_core/tests/test_launcher.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cuda_core/cuda/core/_stream.pyx b/cuda_core/cuda/core/_stream.pyx index 4f40cdb9eda..2dacf51a6d6 100644 --- a/cuda_core/cuda/core/_stream.pyx +++ b/cuda_core/cuda/core/_stream.pyx @@ -618,7 +618,7 @@ cpdef Stream Stream_accept(arg, bint allow_stream_protocol=False): warnings.warn( "Passing foreign stream objects to this function via the " "stream protocol is deprecated. Convert the object explicitly " - "using Stream(obj) instead.", + "using Device.create_stream(obj) instead.", stacklevel=2, category=DeprecationWarning, ) diff --git a/cuda_core/tests/test_launcher.py b/cuda_core/tests/test_launcher.py index c01bf9103f1..7605e2b1a82 100644 --- a/cuda_core/tests/test_launcher.py +++ b/cuda_core/tests/test_launcher.py @@ -528,7 +528,7 @@ def test_launch_invalid_values(init_cuda): msg = ( r"Passing foreign stream objects to this function via the stream " r"protocol is deprecated\. Convert the object explicitly using " - r"Stream\(obj\) instead\." + r"Device\.create_stream\(obj\) instead\." ) with pytest.warns(DeprecationWarning, match=msg): launch(StreamWrapper(stream), config, ker) From 6db8e6eae2ab191a6f10294d4162607b3d6ad27b Mon Sep 17 00:00:00 2001 From: Iamsohungrynow <261225237+Iamsohungrynow@users.noreply.github.com> Date: Sun, 22 Nov 2026 01:49:16 +0800 Subject: [PATCH 2/2] fix(cuda.core): show the stream protocol advice as an instance call Signed-off-by: Iamsohungrynow <261225237+Iamsohungrynow@users.noreply.github.com> --- cuda_core/cuda/core/_stream.pyx | 2 +- cuda_core/tests/test_launcher.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cuda_core/cuda/core/_stream.pyx b/cuda_core/cuda/core/_stream.pyx index 2dacf51a6d6..6397b079ca8 100644 --- a/cuda_core/cuda/core/_stream.pyx +++ b/cuda_core/cuda/core/_stream.pyx @@ -618,7 +618,7 @@ cpdef Stream Stream_accept(arg, bint allow_stream_protocol=False): warnings.warn( "Passing foreign stream objects to this function via the " "stream protocol is deprecated. Convert the object explicitly " - "using Device.create_stream(obj) instead.", + "using device.create_stream(obj) instead.", stacklevel=2, category=DeprecationWarning, ) diff --git a/cuda_core/tests/test_launcher.py b/cuda_core/tests/test_launcher.py index 7605e2b1a82..fc8bc837f40 100644 --- a/cuda_core/tests/test_launcher.py +++ b/cuda_core/tests/test_launcher.py @@ -528,7 +528,7 @@ def test_launch_invalid_values(init_cuda): msg = ( r"Passing foreign stream objects to this function via the stream " r"protocol is deprecated\. Convert the object explicitly using " - r"Device\.create_stream\(obj\) instead\." + r"device\.create_stream\(obj\) instead\." ) with pytest.warns(DeprecationWarning, match=msg): launch(StreamWrapper(stream), config, ker)