Uh oh!
There was an error while loading. Please reload this page.
Move callback wrappers to Python layer - #544
Conversation
vzhurba01
commented
Apr 1, 2025
/ok to test |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
leofang
left a comment
There was a problem hiding this comment.
I have reviewed 3 out of 4 files (haven't had time to cover runtime.pyx.in yet).
Q: I assume so far we have not supported passing a pure Python function as callback to any of the bindings directly, without using ctypes or other means as a trampoline?
| cdef cuAsyncCallbackData *cbData = NULL | ||
| cbData = <cuAsyncCallbackData *>malloc(sizeof(cbData[0])) | ||
| if cbData == NULL: | ||
| return CUresult.CUDA_ERROR_OUT_OF_MEMORY |
There was a problem hiding this comment.
Q: Should this be a 1-tuple?
| return CUresult.CUDA_ERROR_OUT_OF_MEMORY | |
| return (CUresult.CUDA_ERROR_OUT_OF_MEMORY,) |
There was a problem hiding this comment.
It would be good to have type annotations or something else as a way to prevent issues like this from sneaking in.
There was a problem hiding this comment.
It seems currently Cython cannot raise a compile-time error for either case, only a run-time error (which is not desired I think).
cpdef tuple f():
return42defg() -> tuple:
return 42Output:
>>>importtest_tuple>>>test_tuple.f()
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"test_tuple.pyx", line1, intest_tuple.fcpdeftuplef():
File"test_tuple.pyx", line3, intest_tuple.freturn42TypeError: Expectedtuple, gotint>>>test_tuple.g()
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"test_tuple.pyx", line7, intest_tuple.greturn42TypeError: Expectedtuple, gotintUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vzhurba01
commented
Apr 3, 2025
Correct. |
vzhurba01
commented
Apr 3, 2025
/ok to test |
|
close#531