diff --git a/pyopencl/_cffi.py b/pyopencl/_cffi.py index 6df057d61251c538b0463b1b7f737bbc1a4d9c96..3944bbf106d746343c0287977843293e4206be65 100644 --- a/pyopencl/_cffi.py +++ b/pyopencl/_cffi.py @@ -215,6 +215,8 @@ import gc _py_gc = _ffi.callback('int(void)')(gc.collect) _pyrefs = {} + + @_ffi.callback('void(void*)') def _py_deref(handle): try: @@ -222,6 +224,7 @@ def _py_deref(handle): except: pass + # return a new reference of the object pointed to by the handle. # The return value might be different with the input (on PyPy). # _py_deref should be called (once) when the object is not needed anymore. @@ -232,6 +235,7 @@ def _py_ref(handle): _pyrefs[handle] = handle return handle + @_ffi.callback('void(void*, cl_int)') def _py_call(handle, status): _ffi.from_handle(handle)(status)