From: Brendan Miller on
According to the ctypes docs: http://docs.python.org/library/ctypes.html

An errcheck function should return the args tuple when used with out
parameters (section 15.15.2.4. Function prototypes). However, in other
cases it says to return the result, or whatever result you want
returned from the function.

I have a single errcheck function that checks result codes and throws
an exception if the result indicates an error. I'd like to reuse it
with a number of different function, some of which are specified with
out parameters, and some of which are specified in the normal method:

func = my_lib.func
func.restype = c_long
func.argtypes = [c_int, etc]

So, my question is can do I have my errcheck function return the args
tuple in both cases? The documentation seems kind of ambiguous about
how it will behave if a function loaded without output parameters
returns the arguments tuple from errcheck.

Thanks,
Brendan