roudkerk added the comment:

>From Guido's patch:
>        if (!DuplicateHandle(GetCurrentProcess(), (HANDLE)handle, 
>                             GetCurrentProcess(), &newhandle,
>                             0, FALSE, DUPLICATE_SAME_ACCESS)) 
>        {
>                WSASetLastError(GetLastError());
>                return INVALID_SOCKET;
>        }

If you are going to use GetLastError() like that then you really
should change set_error() so that it recognizes non-WSA errors.

The solution is easy: rip out the 80+ lines of Windows specific code
in set_error() and replace them by the much simpler

#ifdef MS_WINDOWS
        int err_no = WSAGetLastError();
        /* PyErr_SetExcFromWindowsErr() invokes FormatMessage() which
           recognizes the error numbers used by both GetLastError() 
           and WSAGetLastError() */
        if (err_no)
            return PyErr_SetExcFromWindowsErr(socket_error, err_no);
#endif

Note that if you make makefile() use a duplicate socket then you can
also remove all the reference counting stuff from the socket subclass.

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1378>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to