[pypy-issue] Issue #1961: Fix errno handling (pypy/pypy)

Armin Rigo issues-reply at bitbucket.org
Wed Jan 14 12:09:48 CET 2015


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


More information about the pypy-issue mailing list