Commit 88249b80 authored by Senthil Kumaran's avatar Senthil Kumaran

merge from 3.3

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.
parents edf33c01 dcdadfe3
...@@ -2259,7 +2259,10 @@ def thishost(): ...@@ -2259,7 +2259,10 @@ def thishost():
"""Return the IP addresses of the current host.""" """Return the IP addresses of the current host."""
global _thishost global _thishost
if _thishost is None: 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 return _thishost
_ftperrors = None _ftperrors = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment