Merge 3.4 (asyncio)

This commit is contained in:
Victor Stinner 2015-04-07 21:38:36 +02:00
commit 3c28878e40
1 changed files with 6 additions and 8 deletions

View File

@ -408,14 +408,12 @@ def sock_connect(self, sock, address):
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)