mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
asyncio: sync with Tulip
* Document why set_result() calls are safe * Cleanup gather(). Use public methods instead of hacks to consume the exception of a future. * sock_connect(): pass directly the fd to _sock_connect_done instead of the socket.
This commit is contained in:
parent
399c59d7bd
commit
3531d9044d
3 changed files with 16 additions and 7 deletions
|
@ -363,15 +363,15 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
|||
break
|
||||
except BlockingIOError:
|
||||
fut.add_done_callback(functools.partial(self._sock_connect_done,
|
||||
sock))
|
||||
fd))
|
||||
self.add_writer(fd, self._sock_connect_cb, fut, sock, address)
|
||||
except Exception as exc:
|
||||
fut.set_exception(exc)
|
||||
else:
|
||||
fut.set_result(None)
|
||||
|
||||
def _sock_connect_done(self, sock, fut):
|
||||
self.remove_writer(sock.fileno())
|
||||
def _sock_connect_done(self, fd, fut):
|
||||
self.remove_writer(fd)
|
||||
|
||||
def _sock_connect_cb(self, fut, sock, address):
|
||||
if fut.cancelled():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue