This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 7dc5ae7894 [CYTHON] Make cython compatible with 3.0 (#15469)
7dc5ae7894 is described below

commit 7dc5ae78941bcbf6fb8ce14a0bf938019d61eb01
Author: Tianqi Chen <[email protected]>
AuthorDate: Thu Aug 3 23:49:40 2023 -0400

    [CYTHON] Make cython compatible with 3.0 (#15469)
    
    This PR makes the cython code compatible with 3.0 also in a way that is 
backward compatible with older cython versions
---
 python/tvm/_ffi/_cython/ndarray.pxi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/tvm/_ffi/_cython/ndarray.pxi 
b/python/tvm/_ffi/_cython/ndarray.pxi
index 9d0eeff0b0..b88698319f 100644
--- a/python/tvm/_ffi/_cython/ndarray.pxi
+++ b/python/tvm/_ffi/_cython/ndarray.pxi
@@ -16,6 +16,7 @@
 # under the License.
 
 from ..runtime_ctypes import TVMArrayHandle
+from cpython cimport PyCapsule_Destructor
 
 cdef const char* _c_str_dltensor = "dltensor"
 cdef const char* _c_str_used_dltensor = "used_dltensor"
@@ -113,7 +114,7 @@ cdef class NDArrayBase:
         with nogil:
             c_api_ret_code = TVMArrayToDLPack(self.chandle, &dltensor)
         CHECK_CALL(c_api_ret_code)
-        return pycapsule.PyCapsule_New(dltensor, _c_str_dltensor, 
_c_dlpack_deleter)
+        return pycapsule.PyCapsule_New(dltensor, _c_str_dltensor, 
<PyCapsule_Destructor>_c_dlpack_deleter)
 
 
 # Import limited object-related function from C++ side to improve the speed

Reply via email to