Fix bare except in Stream_accept that swallows all exceptions#1632
Open
Andy-Jost wants to merge 1 commit intoNVIDIA:mainfrom
Open
Fix bare except in Stream_accept that swallows all exceptions#1632Andy-Jost wants to merge 1 commit intoNVIDIA:mainfrom
Andy-Jost wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
…#1631) Narrow the catch from bare `except: pass` to `except TypeError` with a string check, so that only missing `__cuda_stream__` is silently handled. Buggy protocol implementations and other exceptions now propagate correctly. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Contributor
Author
|
/ok to test a1614ed |
Contributor
Author
|
I found this issue as a follow-on to this comment while searching for other places where |
Andy-Jost
commented
Feb 17, 2026
Comment on lines
+512
to
+514
| except TypeError as e: | ||
| if "__cuda_stream__" not in str(e): | ||
| raise |
Contributor
Author
There was a problem hiding this comment.
cf.
cuda-python/cuda_core/cuda/core/_stream.pyx
Lines 474 to 477 in a1614ed
|
Member
|
@Andy-Jost Just to confirm, this PR can wait after we release v0.6.0, or do you want this to be part of v0.6.0 as well? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
except: passinStream_accepttoexcept TypeErrorwith a string check for"__cuda_stream__", so only the "protocol not supported" case is silently handled__cuda_stream__implementations,RuntimeError,KeyboardInterrupt,SystemExit, etc. now propagate correctlyCloses #1631
Changes
_stream.pyx: Replaceexcept: passwithexcept TypeError as e: if "__cuda_stream__" not in str(e): raiseTest Coverage
Stream_acceptand stream protocol tests cover the happy pathMade with Cursor