Skip to content

Commit d9b08b2

Browse files
committed
Document that getaddrinfo() can return raw data
This is the case for IPv6 addresses if Python was compiled with --disable-ipv6.
1 parent f89e5e2 commit d9b08b2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Doc/library/socket.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -966,10 +966,16 @@ The :mod:`socket` module also offers various network-related services:
966966
a string representing the canonical name of the *host* if
967967
:const:`AI_CANONNAME` is part of the *flags* argument; else *canonname*
968968
will be empty. *sockaddr* is a tuple describing a socket address, whose
969-
format depends on the returned *family* (a ``(address, port)`` 2-tuple for
970-
:const:`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple for
971-
:const:`AF_INET6`), and is meant to be passed to the :meth:`socket.connect`
972-
method.
969+
format depends on the returned *family* and flags Python was compiled with,
970+
and is meant to be passed to the :meth:`socket.connect` method.
971+
972+
*sockaddr* can be one of the following:
973+
974+
* a ``(address, port)`` 2-tuple for :const:`AF_INET`
975+
* a ``(address, port, flowinfo, scope_id)`` 4-tuple for :const:`AF_INET6` if
976+
Python was compiled with ``--enable-ipv6`` (the default)
977+
* a 2-tuple containing raw data for :const:`AF_INET6` if Python was
978+
compiled with ``--disable-ipv6``
973979

974980
.. note::
975981

0 commit comments

Comments
 (0)