File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -808,8 +808,9 @@ The :mod:`socket` module also offers various network-related services:
808
808
it is interpreted as the local host. To find the fully qualified name, the
809
809
hostname returned by :func: `gethostbyaddr ` is checked, followed by aliases for the
810
810
host, if available. The first name which includes a period is selected. In
811
- case no fully qualified domain name is available, the hostname as returned by
812
- :func: `gethostname ` is returned.
811
+ case no fully qualified domain name is available and *name * was provided,
812
+ it is returned unchanged. If *name * was empty or equal to ``'0.0.0.0' ``,
813
+ the hostname from :func: `gethostname ` is returned.
813
814
814
815
815
816
.. function :: gethostbyname(hostname)
Original file line number Diff line number Diff line change @@ -782,8 +782,9 @@ def getfqdn(name=''):
782
782
An empty argument is interpreted as meaning the local host.
783
783
784
784
First the hostname returned by gethostbyaddr() is checked, then
785
- possibly existing aliases. In case no FQDN is available, hostname
786
- from gethostname() is returned.
785
+ possibly existing aliases. In case no FQDN is available and `name`
786
+ was given, it is returned unchanged. If `name` was empty or '0.0.0.0',
787
+ hostname from gethostname() is returned.
787
788
"""
788
789
name = name .strip ()
789
790
if not name or name == '0.0.0.0' :
You can’t perform that action at this time.
0 commit comments