From: Gregory P. Smith Date: Mon, 4 Jan 2010 03:29:50 +0000 (+0000) Subject: Merge the trivial portion of r74426 from trunk. X-Git-Tag: v3.2a1~1898 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b585a0ff03ade21e21ac7510dd667e11eadd9b8b;p=python Merge the trivial portion of r74426 from trunk. socket.sendall() now handles EINTR properly internally. --- diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 7b6046dbc6..fa543cdab9 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2572,8 +2572,21 @@ sock_sendall(PySocketSockObject *s, PyObject *args) #else n = send(s->sock_fd, buf, len, flags); #endif - if (n < 0) + if (n < 0) { +#ifdef EINTR + /* We must handle EINTR here as there is no way for + * the caller to know how much was sent otherwise. */ + if (errno == EINTR) { + /* Run signal handlers. If an exception was + * raised, abort and leave this socket in + * an unknown state. */ + if (PyErr_CheckSignals()) + return NULL; + continue; + } +#endif break; + } buf += n; len -= n; } while (len > 0);