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 @@ -795,8 +795,9 @@ The :mod:`socket` module also offers various network-related services:
795
795
it is interpreted as the local host. To find the fully qualified name, the
796
796
hostname returned by :func: `gethostbyaddr ` is checked, followed by aliases for the
797
797
host, if available. The first name which includes a period is selected. In
798
- case no fully qualified domain name is available, the hostname as returned by
799
- :func: `gethostname ` is returned.
798
+ case no fully qualified domain name is available and *name * was provided,
799
+ it is returned unchanged. If *name * was empty or equal to ``'0.0.0.0' ``,
800
+ the hostname from :func: `gethostname ` is returned.
800
801
801
802
802
803
.. function :: gethostbyname(hostname)
Original file line number Diff line number Diff line change @@ -781,8 +781,9 @@ def getfqdn(name=''):
781
781
An empty argument is interpreted as meaning the local host.
782
782
783
783
First the hostname returned by gethostbyaddr() is checked, then
784
- possibly existing aliases. In case no FQDN is available, hostname
785
- from gethostname() is returned.
784
+ possibly existing aliases. In case no FQDN is available and `name`
785
+ was given, it is returned unchanged. If `name` was empty or '0.0.0.0',
786
+ hostname from gethostname() is returned.
786
787
"""
787
788
name = name .strip ()
788
789
if not name or name == '0.0.0.0' :
You can’t perform that action at this time.
0 commit comments