New issue 1961: Fix errno handling
https://bitbucket.org/pypy/pypy/issue/1961/fix-errno-handling

Armin Rigo:

The handling of errno (and GetLastError on Windows) is fragile.  There are 
cases that can go wrong.

For example, cffi's getwinerror() on Windows tends to return 0 instead of the 
real error when the code in question happens to be traced.  The issue is that 
in this case, a lot more occurs, and the LastError is overwritten with the 
value of some unrelated function call from the tracing.  But the same problem 
can occur anywhere: a major GC for example could trigger it.

Instead, we should have a way to save the errno/LastError around a particular 
function call, which would work at a very low level --- in the section of code 
that is not protected by the GIL.  It would either use some RPython global 
(thread-local) location, or maybe better, work with an explicitly-provided 
pointer to a structure containing the saved value(s).

Responsible: arigo
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to