mirror of https://github.com/python/cpython
bug #1257988: don't bail out on gethostbyname(gethostname()) failure
This commit is contained in:
parent
b88e19c1fc
commit
dcdfd22bb4
|
@ -255,7 +255,11 @@ class SMTP:
|
|||
self.local_hostname = fqdn
|
||||
else:
|
||||
# We can't find an fqdn hostname, so use a domain literal
|
||||
addr = '127.0.0.1'
|
||||
try:
|
||||
addr = socket.gethostbyname(socket.gethostname())
|
||||
except socket.gaierror:
|
||||
pass
|
||||
self.local_hostname = '[%s]' % addr
|
||||
|
||||
def set_debuglevel(self, debuglevel):
|
||||
|
|
Loading…
Reference in New Issue