[Python-checkins] r77295 - python/branches/py3k/Modules/socketmodule.c

gregory.p.smith python-checkins at python.org
Mon Jan 4 04:29:50 CET 2010


Author: gregory.p.smith
Date: Mon Jan  4 04:29:50 2010
New Revision: 77295

Log:
Merge the trivial portion of r74426 from trunk.
socket.sendall() now handles EINTR properly internally.


Modified:
   python/branches/py3k/Modules/socketmodule.c

Modified: python/branches/py3k/Modules/socketmodule.c
==============================================================================
--- python/branches/py3k/Modules/socketmodule.c	(original)
+++ python/branches/py3k/Modules/socketmodule.c	Mon Jan  4 04:29:50 2010
@@ -2572,8 +2572,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);


More information about the Python-checkins mailing list