summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2002-09-24 16:51:00 (GMT)
committerThomas Heller <theller@ctypes.org>2002-09-24 16:51:00 (GMT)
commit106f4c7ba7c6cffb52bc296e6d1dec2294019d0c (patch)
tree8a9a0ccccca8692e06e13ed4801857e3f420f9c9 /Modules
parent2f93644c1dc0a513e70b86a66a052bda2d800120 (diff)
downloadcpython-106f4c7ba7c6cffb52bc296e6d1dec2294019d0c.zip
cpython-106f4c7ba7c6cffb52bc296e6d1dec2294019d0c.tar.gz
cpython-106f4c7ba7c6cffb52bc296e6d1dec2294019d0c.tar.bz2
On Windows, call WSAGetLastError() to retrieve the error number.
Bugfix candidate, will backport to release22-maint myself.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/selectmodule.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 2caa022..8444c12 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -39,7 +39,7 @@ extern void bzero(void *, int);
#endif
#ifdef MS_WINDOWS
-#include <winsock.h>
+#include <windows.h>
#else
#ifdef __BEOS__
#include <net/socket.h>
@@ -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);