@@ -292,6 +292,13 @@ def c_fn(name: str, restype: Optional[type], argtypes):
292
292
293
293
return func
294
294
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
295
302
296
303
# like c_fn, but for functions returning obx_err
297
304
def c_fn_rc (name : str , argtypes ):
@@ -302,7 +309,6 @@ def c_fn_rc(name: str, argtypes):
302
309
func .errcheck = check_obx_err
303
310
return func
304
311
305
-
306
312
def c_fn_qb_cond (name : str , argtypes ):
307
313
""" Like c_fn, but for functions returning obx_qb_cond (checks obx_qb_cond validity). """
308
314
func = C .__getattr__ (name )
@@ -462,7 +468,7 @@ def c_array_pointer(py_list: Union[List[Any], np.ndarray], c_type):
462
468
obx_box = c_fn ('obx_box' , OBX_box_p , [OBX_store_p , obx_schema_id ])
463
469
464
470
# 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 , [
466
472
OBX_box_p , obx_id , ctypes .POINTER (ctypes .c_void_p ), ctypes .POINTER (ctypes .c_size_t )])
467
473
468
474
# OBX_bytes_array* (OBX_box* box);
@@ -483,7 +489,7 @@ def c_array_pointer(py_list: Union[List[Any], np.ndarray], c_type):
483
489
OBX_box_p , OBX_bytes_array_p , ctypes .POINTER (obx_id ), OBXPutMode ])
484
490
485
491
# 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 ])
487
493
488
494
# obx_err (OBX_box* box, uint64_t* out_count);
489
495
obx_box_remove_all = c_fn_rc ('obx_box_remove_all' , [
0 commit comments