From: Thomas Heller Date: Tue, 24 Sep 2002 16:51:00 +0000 (+0000) Subject: On Windows, call WSAGetLastError() to retrieve the error number. X-Git-Tag: v2.3c1~3995 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=106f4c7ba7c6cffb52bc296e6d1dec2294019d0c;p=thirdparty%2FPython%2Fcpython.git On Windows, call WSAGetLastError() to retrieve the error number. Bugfix candidate, will backport to release22-maint myself. --- diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 2caa0225f4c5..8444c12adda7 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -39,7 +39,7 @@ extern void bzero(void *, int); #endif #ifdef MS_WINDOWS -#include +#include #else #ifdef __BEOS__ #include @@ -273,9 +273,15 @@ select_select(PyObject *self, PyObject *args) n = select(max, &ifdset, &ofdset, &efdset, tvp); Py_END_ALLOW_THREADS +#ifdef MS_WINDOWS + if (n == SOCKET_ERROR) { + PyErr_SetExcFromWindowsErr(SelectError, WSAGetLastError()); + } +#else if (n < 0) { PyErr_SetFromErrno(SelectError); } +#endif else if (n == 0) { /* optimization */ ifdlist = PyList_New(0);