summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-10-30 01:26:49 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-10-30 01:26:49 (GMT)
commitc32410ae8fce0bb588cdf2342c0a7de08ed2fba1 (patch)
treeb131441af205f15b137e4defc9eeac28931a2389 /Modules/socketmodule.c
parent4ecd71376c3828dc86217d5cf433959960db7329 (diff)
downloadcpython-c32410ae8fce0bb588cdf2342c0a7de08ed2fba1.zip
cpython-c32410ae8fce0bb588cdf2342c0a7de08ed2fba1.tar.gz
cpython-c32410ae8fce0bb588cdf2342c0a7de08ed2fba1.tar.bz2
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.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index f1b68c9..e5d850c 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);
}