--- Python-2.4.1/Modules/socketmodule.c.orig Sun Nov 7 11:24:25 2004 +++ Python-2.4.1/Modules/socketmodule.c Mon Oct 3 16:22:25 2005 @@ -1736,10 +1736,15 @@ if (s->sock_timeout > 0.0) { if (res < 0 && errno == EINPROGRESS) { + socklen_t res_size = sizeof res; + int save_errno; + timeout = internal_select(s, 1); - res = connect(s->sock_fd, addr, addrlen); - if (res < 0 && errno == EISCONN) - res = 0; + save_errno = errno; + (void)getsockopt(s->sock_fd, SOL_SOCKET, SO_ERROR, + &res, &res_size); + errno = save_errno; + res = res ? -1 : 0; } }