Skip to content

Commit cd1d07a

Browse files
[3.13] gh-89696: Fix loop.sock_connect docs on address resolution (GH-153651) (#153654)
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 ff1c2b7 commit cd1d07a

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
@@ -1140,12 +1140,21 @@ convenient.
11401140

11411141
*sock* must be a non-blocking socket.
11421142

1143+
With :class:`SelectorEventLoop`, *address* does not need to be resolved:
1144+
for :const:`~socket.AF_INET` and :const:`~socket.AF_INET6` sockets,
1145+
``sock_connect`` first checks whether *address* is already resolved by
1146+
calling :func:`socket.inet_pton`, and uses :meth:`loop.getaddrinfo` to
1147+
resolve it if it is not.
1148+
1149+
:class:`ProactorEventLoop`, the default event loop on Windows, does not
1150+
resolve *address*. The host must already be a numeric IP address; passing
1151+
a host name raises :exc:`OSError`. Resolve the address with
1152+
:meth:`loop.getaddrinfo` first, or use :meth:`loop.create_connection`,
1153+
which resolves the address on every platform.
1154+
11431155
.. versionchanged:: 3.5.2
1144-
``address`` no longer needs to be resolved. ``sock_connect``
1145-
will try to check if the *address* is already resolved by calling
1146-
:func:`socket.inet_pton`. If not,
1147-
:meth:`loop.getaddrinfo` will be used to resolve the
1148-
*address*.
1156+
With :class:`SelectorEventLoop`, ``address`` no longer needs to be
1157+
resolved.
11491158

11501159
.. seealso::
11511160

0 commit comments

Comments
 (0)