diff options
-rwxr-xr-x | Doc/library/socket.rst | 5 | ||||
-rwxr-xr-x | Lib/socket.py | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index 95c7d7e..d668c6b 100755 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -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 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, the hostname as returned by - :func:`gethostname` is returned. + 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. .. function:: gethostbyname(hostname) diff --git a/Lib/socket.py b/Lib/socket.py index a64ae40..ef82c49 100755 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -782,8 +782,9 @@ 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. In case no FQDN is available, hostname - from gethostname() is returned. + possibly existing aliases. In case no FQDN is available and `name` + was given, it is returned unchanged. If `name` was empty or '0.0.0.0', + hostname from gethostname() is returned. """ name = name.strip() if not name or name == '0.0.0.0': |