Skip to content

gh-60856: Be explicit about localhost for socket.getfqdn #93451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Doc/library/socket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,8 @@ The following functions all create :ref:`socket objects <socket-objects>`.
``(host, port)``) and returns the socket object.

*family* should be either :data:`AF_INET` or :data:`AF_INET6`.
*backlog* is the queue size passed to :meth:`socket.listen`; if not specified
, a default reasonable value is chosen.
*backlog* is the queue size passed to :meth:`socket.listen`; if not
specified, a default reasonable value is chosen.
Copy link
Contributor Author

@slateny slateny Mar 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small formatting fix to remove space before comma for this:

image

*reuse_port* dictates whether to set the :data:`SO_REUSEPORT` socket option.

If *dualstack_ipv6* is true and the platform supports it the socket will
Expand Down Expand Up @@ -963,15 +963,15 @@ The :mod:`socket` module also offers various network-related services:
for IPv6 multicast addresses, string representing an address will not
contain ``%scope_id`` part.

.. function:: getfqdn([name])
.. function:: getfqdn(name='')

Return a fully qualified domain name for *name*. If *name* is omitted or empty,
it is interpreted as the local host. To find the fully qualified name, the
Return a fully qualified domain name for *name*.
To find the fully qualified name, the
hostname returned by :func:`gethostbyaddr` is checked, followed by aliases for the
host, if available. The first name which includes a period is selected. In
case no fully qualified domain name is available and *name* was provided,
it is returned unchanged. If *name* was empty or equal to ``'0.0.0.0'``,
the hostname from :func:`gethostname` is returned.
it is returned unchanged. If *name* is omitted, or equal to ``'0.0.0.0'``,
``'::'``, or ``''``, the hostname from :func:`gethostname` is returned.


.. function:: gethostbyname(hostname)
Expand Down