@@ -292,6 +292,13 @@ def c_fn(name: str, restype: Optional[type], argtypes):
292292
293293 return func
294294
295+ # creates a global function "name" with the given restype & argtypes, calling C function with the same name.
296+ # no error checking is done on restype as this is defered to higher-level functions.
297+ def c_fn_nocheck (name : str , restype : type , argtypes ):
298+ func = C .__getattr__ (name )
299+ func .argtypes = argtypes
300+ func .restype = restype
301+ return func
295302
296303# like c_fn, but for functions returning obx_err
297304def c_fn_rc (name : str , argtypes ):
@@ -302,7 +309,6 @@ def c_fn_rc(name: str, argtypes):
302309 func .errcheck = check_obx_err
303310 return func
304311
305-
306312def c_fn_qb_cond (name : str , argtypes ):
307313 """ Like c_fn, but for functions returning obx_qb_cond (checks obx_qb_cond validity). """
308314 func = C .__getattr__ (name )
@@ -462,7 +468,7 @@ def c_array_pointer(py_list: Union[List[Any], np.ndarray], c_type):
462468obx_box = c_fn ('obx_box' , OBX_box_p , [OBX_store_p , obx_schema_id ])
463469
464470# obx_err (OBX_box* box, obx_id id, const void** data, size_t* size);
465- obx_box_get = c_fn_rc ('obx_box_get' , [
471+ obx_box_get = c_fn_nocheck ('obx_box_get' , obx_err , [
466472 OBX_box_p , obx_id , ctypes .POINTER (ctypes .c_void_p ), ctypes .POINTER (ctypes .c_size_t )])
467473
468474# OBX_bytes_array* (OBX_box* box);
@@ -483,7 +489,7 @@ def c_array_pointer(py_list: Union[List[Any], np.ndarray], c_type):
483489 OBX_box_p , OBX_bytes_array_p , ctypes .POINTER (obx_id ), OBXPutMode ])
484490
485491# obx_err (OBX_box* box, obx_id id);
486- obx_box_remove = c_fn_rc ('obx_box_remove' , [OBX_box_p , obx_id ])
492+ obx_box_remove = c_fn_nocheck ('obx_box_remove' , obx_err , [OBX_box_p , obx_id ])
487493
488494# obx_err (OBX_box* box, uint64_t* out_count);
489495obx_box_remove_all = c_fn_rc ('obx_box_remove_all' , [
0 commit comments