[Python-checkins] cpython (merge 3.4 -> default): Merge 3.4 (asyncio)

victor.stinner python-checkins at python.org
Tue Apr 7 21:40:43 CEST 2015


https://hg.python.org/cpython/rev/85a5265909cb
changeset:   95479:85a5265909cb
parent:      95477:a48e76252952
parent:      95478:eca51493c770
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Apr 07 21:38:36 2015 +0200
summary:
  Merge 3.4 (asyncio)

files:
  Lib/asyncio/selector_events.py |  14 ++++++--------
  1 files changed, 6 insertions(+), 8 deletions(-)


diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -408,14 +408,12 @@
     def _sock_connect(self, fut, sock, address):
         fd = sock.fileno()
         try:
-            while True:
-                try:
-                    sock.connect(address)
-                except InterruptedError:
-                    continue
-                else:
-                    break
-        except BlockingIOError:
+            sock.connect(address)
+        except (BlockingIOError, InterruptedError):
+            # Issue #23618: When the C function connect() fails with EINTR, the
+            # connection runs in background. We have to wait until the socket
+            # becomes writable to be notified when the connection succeed or
+            # fails.
             fut.add_done_callback(functools.partial(self._sock_connect_done,
                                                     fd))
             self.add_writer(fd, self._sock_connect_cb, fut, sock, address)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list