Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 61875:dca3cb19dbdd 2.6
Merged revisions 74426 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74426 | gregory.p.smith | 2009-08-13 14:54:50 -0400 (Thu, 13 Aug 2009) | 4 lines
Fix issue1628205: Socket file objects returned by socket.socket.makefile() now
properly handles EINTR within the read, readline, write & flush methods.
The socket.sendall() method now properly handles interrupted system calls.
........
| author | Jean-Paul Calderone <exarkun@divmod.com> |
|---|---|
| date | Sun, 23 May 2010 15:22:08 +0000 |
| parents | e38335d4df91 |
| children | 787b969d37f0 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Sun May 23 14:58:05 2010 +0000 +++ b/Modules/socketmodule.c Sun May 23 15:22:08 2010 +0000 @@ -2723,8 +2723,21 @@ #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);
