Richard Oudkerk <[email protected]> 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 <[email protected]>
<http://bugs.python.org/issue13210>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com