This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients alexis, brian.curtin, eric.araujo, jackjansen, kristjan.jonsson, loewis, mark.dickinson, mhammond, sable, santoso.wijaya, sbt, tarek, tim.golden, vstinner
Date 2012-04-26.15:04:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1335452700.28.0.945936919182.issue13210@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2012-04-26 15:05:00sbtsetrecipients: + sbt, loewis, mhammond, jackjansen, mark.dickinson, kristjan.jonsson, vstinner, sable, tim.golden, tarek, eric.araujo, brian.curtin, santoso.wijaya, alexis
2012-04-26 15:05:00sbtsetmessageid: <1335452700.28.0.945936919182.issue13210@psf.upfronthosting.co.za>
2012-04-26 15:04:59sbtlinkissue13210 messages
2012-04-26 15:04:59sbtcreate