In the libclang/python bindings, we currently have 43 library library functions registered as ctypes functions returning bool. None of the libclang functions on C-side seem to return booleans, instead they return unsigned (and sometimes signed) ints.
The ctypes module seems to automatically cast the actual unsigned return values to a value of the registered bool type, which works as expected: a return of 0 is interpreted as false, all other returns are interpreted as true.
However, this makes the code confusing to read as it obfuscates the real return type of these library functions in the bindings code. The library functions should be registered with return types matching their declaration, e.g. c_uint.
This means
- checking all
bool return types in the FUNCTION_LIST and adapting their return types to c_uint or c_int respectively
- adding a
bool cast to the return of all functions directly returning the results of these library functions
- removing
type: ignore [no-any-return] annotations where such a cast is applied