[issue13210] Support Visual Studio 2010

Richard Oudkerk report at bugs.python.org
Thu Apr 26 17:05:00 CEST 2012


Richard Oudkerk <shibturn at gmail.com> added the comment:

> the errno codes (EAGAIN etc) are provided only as a compatibility for 
> posix apps that test "errno".  On windows, we use the WSA return values 
> from the api functions and WsaGetLastError().
> ...
> So, the proposed patch is not a change, it is merely reinforcing the 
> previous practice of prefering the native error codes over the 'errno' 
> emulation.

Except that Microsoft's C library also uses some of the non-WSA versions.  For instance read() (or _read()) is documented to set errno to EBADF or EINVAL on error.  So EBADF and EINVAL are just as "native" as WSAEBADF and WSAEINVAL.

It is also quite common for python's C code to do stuff like

    errno = EINVAL;
    PyErr_SetFromErrno(PyExc_OSError);

errnomap in Objects/exceptions.c is used to convert some OSError exceptions to subclasses like PermissionError.  It shouldn't be hard to use it to also convert WSAEINVAL to EINVAL etc.

----------
nosy: +sbt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13210>
_______________________________________


More information about the Python-bugs-list mailing list