MCPcopy Index your code
hub / github.com/RustPython/RustPython / _sock_connect

Method _sock_connect

Lib/asyncio/selector_events.py:650–671  ·  view source on GitHub ↗
(self, fut, sock, address)

Source from the content-addressed store, hash-verified

648 fut = None
649
650 def _sock_connect(self, fut, sock, address):
651 fd = sock.fileno()
652 try:
653 sock.connect(address)
654 except (BlockingIOError, InterruptedError):
655 # Issue #23618: When the C function connect() fails with EINTR, the
656 # connection runs in background. We have to wait until the socket
657 # becomes writable to be notified when the connection succeed or
658 # fails.
659 self._ensure_fd_no_transport(fd)
660 handle = self._add_writer(
661 fd, self._sock_connect_cb, fut, sock, address)
662 fut.add_done_callback(
663 functools.partial(self._sock_write_done, fd, handle=handle))
664 except (SystemExit, KeyboardInterrupt):
665 raise
666 except BaseException as exc:
667 fut.set_exception(exc)
668 else:
669 fut.set_result(None)
670 finally:
671 fut = None
672
673 def _sock_write_done(self, fd, fut, handle=None):
674 if handle is None or not handle.cancelled():

Callers 1

sock_connectMethod · 0.95

Calls 8

_add_writerMethod · 0.95
partialMethod · 0.80
filenoMethod · 0.45
connectMethod · 0.45
add_done_callbackMethod · 0.45
set_exceptionMethod · 0.45
set_resultMethod · 0.45

Tested by

no test coverage detected