PySocketSock_connect_ex(): On Windows, return the correct Windows exit

code.  The patch is from Jeremy, and allows test_asynchat to run again.
Bugfix candidate.
This commit is contained in:
Tim Peters 2001-10-30 01:26:49 +00:00
parent 4ecd71376c
commit c32410ae8f

View file

@ -1267,8 +1267,13 @@ PySocketSock_connect_ex(PySocketSockObject *s, PyObject *addro)
Py_BEGIN_ALLOW_THREADS
res = connect(s->sock_fd, addr, addrlen);
Py_END_ALLOW_THREADS
if (res != 0)
if (res != 0) {
#ifdef MS_WINDOWS
res = WSAGetLastError();
#else
res = errno;
#endif
}
return PyInt_FromLong((long) res);
}