Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > My code sample did not intend to clear errno, it was intended to set errno > to the last value that the ctypes-copy had before the call.
It's the same thing (to me): you change errno. > To make my point clear (in case is isn't already): In the code > sample that Armin posted, it is impossible to guarantee that no > stdlib function is called between the readdir() and the get_errno() call: > > dirent = linux_c_lib.readdir(byref(dir)) > if not dirent: > if ctypes.get_errno() == 0: > > Consider the garbage collector free some objects that release resources > they have, in other words call functions different from free(3). However, even the TLS copy of errno may change because of this, if the finalizer of some object invokes ctypes, right? > Anyway, how can we proceed? Do you have a suggestion? I'll leave it up to you to decide - you'll take both blame and praise, anyway, so I don't want to talk you into coming up with an API that you don't like. __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1798> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com