Commit 1ab05faf by Tianqi Chen Committed by GitHub

[CYTHON] Fix exception propagation for cython3 (#1046)

parent 8084a4da
...@@ -64,8 +64,8 @@ ctypedef int (*TVMPackedCFunc)( ...@@ -64,8 +64,8 @@ ctypedef int (*TVMPackedCFunc)(
ctypedef void (*TVMPackedCFuncFinalizer)(void* resource_handle) ctypedef void (*TVMPackedCFuncFinalizer)(void* resource_handle)
cdef extern from "tvm/runtime/c_runtime_api.h": cdef extern from "tvm/runtime/c_runtime_api.h":
void TVMAPISetLastError(const char* msg); void TVMAPISetLastError(const char* msg)
const char *TVMGetLastError(); const char *TVMGetLastError()
int TVMFuncCall(TVMFunctionHandle func, int TVMFuncCall(TVMFunctionHandle func,
TVMValue* arg_values, TVMValue* arg_values,
int* type_codes, int* type_codes,
......
...@@ -74,10 +74,10 @@ def convert_to_tvm_func(object pyfunc): ...@@ -74,10 +74,10 @@ def convert_to_tvm_func(object pyfunc):
return ret return ret
cdef inline void make_arg(object arg, cdef inline int make_arg(object arg,
TVMValue* value, TVMValue* value,
int* tcode, int* tcode,
list temp_args): list temp_args) except -1:
"""Pack arguments into c args tvm call accept""" """Pack arguments into c args tvm call accept"""
cdef unsigned long long ptr cdef unsigned long long ptr
if isinstance(arg, NodeBase): if isinstance(arg, NodeBase):
...@@ -152,6 +152,7 @@ cdef inline void make_arg(object arg, ...@@ -152,6 +152,7 @@ cdef inline void make_arg(object arg,
temp_args.append(arg) temp_args.append(arg)
else: else:
raise TypeError("Don't know how to handle type %s" % type(arg)) raise TypeError("Don't know how to handle type %s" % type(arg))
return 0
cdef inline bytearray make_ret_bytes(void* chandle): cdef inline bytearray make_ret_bytes(void* chandle):
handle = ctypes_handle(chandle) handle = ctypes_handle(chandle)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment