mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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:
parent
4ecd71376c
commit
c32410ae8f
1 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue