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 <1195150446.52.0.774304045884.issue1378@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
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: <1195150446.52.0.774304045884.issue1378@psf.upfronthosting.co.za>
2007-11-15 18:14:06roudkerklinkissue1378 messages
2007-11-15 18:14:06roudkerkcreate