]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport of the checkin of revision 2.69 of selectmodule.c
authorThomas Heller <theller@ctypes.org>
Tue, 24 Sep 2002 17:24:25 +0000 (17:24 +0000)
committerThomas Heller <theller@ctypes.org>
Tue, 24 Sep 2002 17:24:25 +0000 (17:24 +0000)
On Windows, call WSAGetLastError() to retrieve the error number.

Bugfix candidate, will backport to release22-maint myself.

Modules/selectmodule.c

index ceaf3fa92d20c286907088f7059dd496eb610a7b..ec3a8c735552bdf4de456b64c969000bd0eb98ea 100644 (file)
@@ -268,9 +268,16 @@ select_select(PyObject *self, PyObject *args)
        n = select(max, &ifdset, &ofdset, &efdset, tvp);
        Py_END_ALLOW_THREADS
 
+#ifdef MS_WINDOWS
+       if (n == SOCKET_ERROR) {
+               errno = WSAGetLastError();
+               PyErr_SetFromErrno(SelectError);
+       }
+#else
        if (n < 0) {
                PyErr_SetFromErrno(SelectError);
        }
+#endif
        else if (n == 0) {
                 /* optimization */
                ifdlist = PyList_New(0);