mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
bpo-40635: Fix getfqdn() docstring and docs (GH-27971)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
f9cd40f5e2
commit
fdcb675eed
2 changed files with 6 additions and 4 deletions
|
@ -808,8 +808,9 @@ The :mod:`socket` module also offers various network-related services:
|
||||||
it is interpreted as the local host. To find the fully qualified name, the
|
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
|
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
|
host, if available. The first name which includes a period is selected. In
|
||||||
case no fully qualified domain name is available, the hostname as returned by
|
case no fully qualified domain name is available and *name* was provided,
|
||||||
:func:`gethostname` is returned.
|
it is returned unchanged. If *name* was empty or equal to ``'0.0.0.0'``,
|
||||||
|
the hostname from :func:`gethostname` is returned.
|
||||||
|
|
||||||
|
|
||||||
.. function:: gethostbyname(hostname)
|
.. function:: gethostbyname(hostname)
|
||||||
|
|
|
@ -782,8 +782,9 @@ def getfqdn(name=''):
|
||||||
An empty argument is interpreted as meaning the local host.
|
An empty argument is interpreted as meaning the local host.
|
||||||
|
|
||||||
First the hostname returned by gethostbyaddr() is checked, then
|
First the hostname returned by gethostbyaddr() is checked, then
|
||||||
possibly existing aliases. In case no FQDN is available, hostname
|
possibly existing aliases. In case no FQDN is available and `name`
|
||||||
from gethostname() is returned.
|
was given, it is returned unchanged. If `name` was empty or '0.0.0.0',
|
||||||
|
hostname from gethostname() is returned.
|
||||||
"""
|
"""
|
||||||
name = name.strip()
|
name = name.strip()
|
||||||
if not name or name == '0.0.0.0':
|
if not name or name == '0.0.0.0':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue