mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
bug #1257988: don't bail out on gethostbyname(gethostname()) failure
This commit is contained in:
parent
b88e19c1fc
commit
dcdfd22bb4
1 changed files with 5 additions and 1 deletions
|
|
@ -255,7 +255,11 @@ def __init__(self, host = '', port = 0, local_hostname = None):
|
||||||
self.local_hostname = fqdn
|
self.local_hostname = fqdn
|
||||||
else:
|
else:
|
||||||
# We can't find an fqdn hostname, so use a domain literal
|
# We can't find an fqdn hostname, so use a domain literal
|
||||||
addr = socket.gethostbyname(socket.gethostname())
|
addr = '127.0.0.1'
|
||||||
|
try:
|
||||||
|
addr = socket.gethostbyname(socket.gethostname())
|
||||||
|
except socket.gaierror:
|
||||||
|
pass
|
||||||
self.local_hostname = '[%s]' % addr
|
self.local_hostname = '[%s]' % addr
|
||||||
|
|
||||||
def set_debuglevel(self, debuglevel):
|
def set_debuglevel(self, debuglevel):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue