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 roudkerk
Recipients christian.heimes, gvanrossum, nnorwitz, roudkerk, theller
Date 2007-11-15.18:14:06
SpamBayes Score 0.03313379
Marked as misclassified No
Message-id <>
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

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

Note that if you make makefile() use a duplicate socket then you can
also remove all the reference counting stuff from the socket subclass.
Date User Action Args
2007-11-15 18:14:06roudkerksetspambayes_score: 0.0331338 -> 0.03313379
recipients: + roudkerk, gvanrossum, nnorwitz, theller, christian.heimes
2007-11-15 18:14:06roudkerksetspambayes_score: 0.0331338 -> 0.0331338
messageid: <>
2007-11-15 18:14:06roudkerklinkissue1378 messages
2007-11-15 18:14:06roudkerkcreate