Visitar URL original
bpo-40635: Fix getfqdn() docstring and docs by akulakov · Pull Request #27971 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update for accuracy
  • Loading branch information
akulakov committed Aug 26, 2021
commit dfe540afd1a57c2fa3f1f3ed6e73a0c64e9e6ebe
5 changes: 3 additions & 2 deletions Doc/library/socket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,9 @@ The :mod:`socket` module also offers various network-related services:
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
hostname returned by :func:`gethostbyaddr` is checked, followed by aliases for the
host, if available. The first name which includes a period is selected. If *name* is empty
or is ``'0.0.0.0'``, hostname from :func:`gethostname` is returned.
host, if available. The first name which includes a period is selected. If that logic
fails and *name* is empty or is ``'0.0.0.0'``, hostname from :func:`gethostname` is
returned.


.. function:: gethostbyname(hostname)
Expand Down
4 changes: 2 additions & 2 deletions Lib/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,8 @@ def getfqdn(name=''):
An empty argument is interpreted as meaning the local host.

First the hostname returned by gethostbyaddr() is checked, then
possibly existing aliases. If `name` is empty or is '0.0.0.0',
hostname from gethostname() is returned.
possibly existing aliases. If that logic fails and `name` is empty or is
'0.0.0.0', hostname from gethostname() is returned.
"""
name = name.strip()
if not name or name == '0.0.0.0':
Expand Down