mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix thishost helper funtion in urllib. Returns the ipaddress of localhost when
hostname is resolvable by socket.gethostname for local machine. This all fixes certain freebsd builtbot failures.
This commit is contained in:
parent
4e42ae81f6
commit
dcdadfe39a
1 changed files with 4 additions and 1 deletions
|
@ -2229,7 +2229,10 @@ def thishost():
|
|||
"""Return the IP addresses of the current host."""
|
||||
global _thishost
|
||||
if _thishost is None:
|
||||
_thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
|
||||
try:
|
||||
_thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
|
||||
except socket.gaierror:
|
||||
_thishost = tuple(socket.gethostbyname_ex('localhost')[2])
|
||||
return _thishost
|
||||
|
||||
_ftperrors = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue