(
fn: "ctypes._NamedFuncPointer",
*simple_args,
map_extra: Optional[StructMap] = None,
)
| 344 | |
| 345 | @handle |
| 346 | def binding_base( |
| 347 | fn: "ctypes._NamedFuncPointer", |
| 348 | *simple_args, |
| 349 | map_extra: Optional[StructMap] = None, |
| 350 | ) -> Any: |
| 351 | smap = {**STRUCT_MAP, **(map_extra or {})} |
| 352 | |
| 353 | args = [i if i is not NULL else None for i in simple_args] |
| 354 | |
| 355 | validator_args = [ |
| 356 | arg |
| 357 | if ( |
| 358 | (not isinstance(arg, FunctionType)) |
| 359 | and (not isinstance(arg, PyCFuncPtrType)) |
| 360 | ) |
| 361 | else _solve_func( |
| 362 | arg, # type: ignore |
| 363 | typ, # type: ignore |
| 364 | smap, |
| 365 | ) |
| 366 | for arg, typ in zip( |
| 367 | args, |
| 368 | fn.argtypes or [None for _ in args], # type: ignore |
| 369 | ) |
| 370 | ] |
| 371 | |
| 372 | _validate_args( |
| 373 | validator_args, |
| 374 | fn, |
| 375 | smap, |
| 376 | ) |
| 377 | |
| 378 | res = fn( |
| 379 | *[ |
| 380 | i |
| 381 | if not isinstance( |
| 382 | i, |
| 383 | _CFuncTransport, |
| 384 | ) |
| 385 | else i.c_func |
| 386 | for i in validator_args |
| 387 | ] |
| 388 | ) |
| 389 | |
| 390 | return _decode_response( |
| 391 | res, |
| 392 | smap, |
| 393 | fn, |
| 394 | ) |
| 395 | |
| 396 | @handle |
| 397 | def make_string(data: StringLike) -> Union[bytes, ctypes.c_char_p]: |
no test coverage detected