Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 20756:828bf317880a legacy-trunk
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.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Tue, 30 Oct 2001 01:26:49 +0000 |
| parents | 73cabe664c11 |
| children | 77bb2ae067c2 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Mon Oct 29 22:58:55 2001 +0000 +++ b/Modules/socketmodule.c Tue Oct 30 01:26:49 2001 +0000 @@ -1267,8 +1267,13 @@ 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); }
