I am stuck with a fairly complex Python module that does not return useful error codes (it actually fails disturbingly silently). However, the underlying C library it calls
It looks like you can use this patch that will provide you with ctypes.get_errno/set_errno
http://bugs.python.org/issue1798
This is the patch that was actually applied to the repository:
http://svn.python.org/view?view=rev&revision=63977
Otherwise, adding a new C module that does nothing but return errno /is/ disgusting, but so is the library that you're using. I would do that in preference to patching python myself.