mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Fix for issue5625 - test_urllib2 fails - urlopen error file not on local host.
This is on hosts with multiple ip addresses.
This commit is contained in:
@@ -1264,8 +1264,9 @@ class FileHandler(BaseHandler):
|
||||
def get_names(self):
|
||||
if FileHandler.names is None:
|
||||
try:
|
||||
FileHandler.names = (socket.gethostbyname('localhost'),
|
||||
socket.gethostbyname(socket.gethostname()))
|
||||
FileHandler.names = tuple(
|
||||
socket.gethostbyname_ex('localhost')[2] +
|
||||
socket.gethostbyname_ex(socket.gethostname())[2])
|
||||
except socket.gaierror:
|
||||
FileHandler.names = (socket.gethostbyname('localhost'),)
|
||||
return FileHandler.names
|
||||
|
||||
Reference in New Issue
Block a user