Author eryksun
Recipients eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-08-27.00:48:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1566866913.76.0.259737803786.issue37705@roundup.psfhosted.org>
In-reply-to
Content
> It also seems like at least some of the WSA* constants (e.g. 
> WSAEBADF==10009) are the equivalent errno plus 10000 
> (e.g.EBADF==9). Should we be mapping those back to the 
> errno value?

Mapping WSAEINTR (10004) -> EINTR (4) and WSAEACCES (10013) -> EACCES (13) would allow special casing them as InterruptedError and PermissionError. This is different from the aliases such as EWOULDBLOCK = WSAEWOULDBLOCK, but it should be fine since the six affected values are singled out in WinSock2.h as C errno values. 

So the Winsock section becomes a switch:

        /* Winsock error codes (10000-11999) are errno values. */
        if (winerror >= 10000 && winerror < 12000) {
            switch(winerror) {
            case WSAEINTR:
            case WSAEBADF:
            case WSAEACCES:
            case WSAEFAULT:
            case WSAEINVAL:
            case WSAEMFILE:
                /* Winsock definitions of errno values. See WinSock2.h */
                return winerror - 10000;
            default:
                return winerror;
            }
        }
History
Date User Action Args
2019-08-27 00:48:33eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower
2019-08-27 00:48:33eryksunsetmessageid: <1566866913.76.0.259737803786.issue37705@roundup.psfhosted.org>
2019-08-27 00:48:33eryksunlinkissue37705 messages
2019-08-27 00:48:33eryksuncreate