Commit b9d12f4
fix(cuda.core): reset DevicePtrHandle before raising in Buffer._init
_apply_deallocation_stream raised after deviceptr_create_with_mr, so
the partially-initialised Buffer's __dealloc__ ran during exception
unwinding. The DevicePtrHandle destructor invoked _mr_dealloc_callback,
which caught the inner NotImplementedError from mr.deallocate and cleared
the exception state, leaving Buffer._init returning NULL with no exception
set (SystemError).
Fix: inline the set_deallocation_stream call in _init and reset the
handle before raising on failure, preventing the callback from running.
Buffer_close is unaffected: if _apply_deallocation_stream raises there,
the handle is preserved in place and no destructor fires.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 57bced8 commit b9d12f4
1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
219 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
220 | 233 | | |
221 | 234 | | |
222 | 235 | | |
| |||
0 commit comments