From c32410ae8fce0bb588cdf2342c0a7de08ed2fba1 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 30 Oct 2001 01:26:49 +0000 Subject: [PATCH] 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. --- Modules/socketmodule.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index f1b68c9443..e5d850cb3b 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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); } -- 2.50.1