mirror of
https://github.com/python/cpython.git
synced 2025-10-28 17:13:08 +00:00
On Windows, call WSAGetLastError() to retrieve the error number.
Bugfix candidate, will backport to release22-maint myself.
This commit is contained in:
parent
2f93644c1d
commit
106f4c7ba7
1 changed files with 7 additions and 1 deletions
|
|
@ -39,7 +39,7 @@ extern void bzero(void *, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
#include <winsock.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#ifdef __BEOS__
|
#ifdef __BEOS__
|
||||||
#include <net/socket.h>
|
#include <net/socket.h>
|
||||||
|
|
@ -273,9 +273,15 @@ select_select(PyObject *self, PyObject *args)
|
||||||
n = select(max, &ifdset, &ofdset, &efdset, tvp);
|
n = select(max, &ifdset, &ofdset, &efdset, tvp);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
if (n == SOCKET_ERROR) {
|
||||||
|
PyErr_SetExcFromWindowsErr(SelectError, WSAGetLastError());
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
PyErr_SetFromErrno(SelectError);
|
PyErr_SetFromErrno(SelectError);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else if (n == 0) {
|
else if (n == 0) {
|
||||||
/* optimization */
|
/* optimization */
|
||||||
ifdlist = PyList_New(0);
|
ifdlist = PyList_New(0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue