Eryk Sun <eryk...@gmail.com> added the comment:

> 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;
            }
        }

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37705>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to