This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author arigo
Recipients amaury.forgeotdarc, arigo, fijal, theller
Date 2008-05-22.19:57:02
SpamBayes Score 0.0466291
Marked as misclassified No
Message-id <>
Alternatively, we can try to make ctypes "feel like" C itself:

     while True:
         dirent = linux_c_lib.readdir(byref(dir))
         if not dirent:
             if ctypes.get_errno() == 0:
                 raise IOError("oups!")

We are doing this kind of thing in PyPy with the "rffi" foreign function
interface.  To achieve this result, ctypes would have to maintain
internally an internal, global (but thread-local) variable representing
the current errno value.  Just before doing a C library function call,
ctypes would copy this variable into the real C-level errno; and
immediately after the call it would read the C-level errno back into its
internal variable.  In this way, other calls to C functions unrelated to
ctypes don't interfere.  The get_errno() and set_errno() functions
merely access the thread-local variable (not the real C-level errno).
Date User Action Args
2008-05-22 19:57:04arigosetspambayes_score: 0.0466291 -> 0.0466291
recipients: + arigo, theller, amaury.forgeotdarc, fijal
2008-05-22 19:57:04arigosetspambayes_score: 0.0466291 -> 0.0466291
messageid: <>
2008-05-22 19:57:03arigolinkissue1798 messages
2008-05-22 19:57:02arigocreate