From: Anthony Baxter Date: Thu, 1 Nov 2001 14:00:11 +0000 (+0000) Subject: backport tim's 1.191: X-Git-Tag: v2.1.2c1~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3357529c3460b73a56474a3dbc1e70cadc001443;p=thirdparty%2FPython%2Fcpython.git backport tim's 1.191: PySocketSock_connect_ex(): On Windows, return the correct Windows exit code. The patch is from Jeremy, and allows test_asynchat to run again. --- diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index c2e38804e81f..083676684728 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1108,8 +1108,13 @@ PySocketSock_connect_ex(PySocketSockObject *s, PyObject *args) 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); }