Skip to content

Commit c628cd7

Browse files
[3.14] gh-89696: Fix loop.sock_connect docs on address resolution (GH-153651) (#153653)
gh-89696: Fix `loop.sock_connect` docs on address resolution (GH-153651) (cherry picked from commit 1fece44) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
1 parent b0842ed commit c628cd7

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

Doc/library/asyncio-eventloop.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,12 +1156,21 @@ convenient.
11561156

11571157
*sock* must be a non-blocking socket.
11581158

1159+
With :class:`SelectorEventLoop`, *address* does not need to be resolved:
1160+
for :const:`~socket.AF_INET` and :const:`~socket.AF_INET6` sockets,
1161+
``sock_connect`` first checks whether *address* is already resolved by
1162+
calling :func:`socket.inet_pton`, and uses :meth:`loop.getaddrinfo` to
1163+
resolve it if it is not.
1164+
1165+
:class:`ProactorEventLoop`, the default event loop on Windows, does not
1166+
resolve *address*. The host must already be a numeric IP address; passing
1167+
a host name raises :exc:`OSError`. Resolve the address with
1168+
:meth:`loop.getaddrinfo` first, or use :meth:`loop.create_connection`,
1169+
which resolves the address on every platform.
1170+
11591171
.. versionchanged:: 3.5.2
1160-
``address`` no longer needs to be resolved. ``sock_connect``
1161-
will try to check if the *address* is already resolved by calling
1162-
:func:`socket.inet_pton`. If not,
1163-
:meth:`loop.getaddrinfo` will be used to resolve the
1164-
*address*.
1172+
With :class:`SelectorEventLoop`, ``address`` no longer needs to be
1173+
resolved.
11651174

11661175
.. seealso::
11671176

0 commit comments

Comments
 (0)