mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)
This commit is contained in:
parent
a7715ccfba
commit
12be23cf3c
3 changed files with 7 additions and 2 deletions
|
@ -785,11 +785,11 @@ def getfqdn(name=''):
|
|||
|
||||
First the hostname returned by gethostbyaddr() is checked, then
|
||||
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',
|
||||
was given, it is returned unchanged. If `name` was empty, '0.0.0.0' or '::',
|
||||
hostname from gethostname() is returned.
|
||||
"""
|
||||
name = name.strip()
|
||||
if not name or name == '0.0.0.0':
|
||||
if not name or name in ('0.0.0.0', '::'):
|
||||
name = gethostname()
|
||||
try:
|
||||
hostname, aliases, ipaddrs = gethostbyaddr(name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue