Martin Panter added the comment:

Looking at this more closely, the check seems to be there just to check if 
basic DNS lookups are working. It was added for Issue 12804. One option might 
be to replace it with a support.transient_internet() handler:

# Check for internet access before running test (issue #12804).
with support.transient_internet('python.org'):
    socket.gethostbyname('python.org')
# these should all be successful
...

According to the socket module source code, gethostbyname() calls the OS-level 
getaddrinfo() rather gethostbyname(), hence the “gaierror” handling. The error 
codes that get raised seem to be a platform-dependent mess, but 
transient_internet() looks like it catches EAI_NONAME, _FAIL, _NODATA and 
WSANO_DATA (among others). EAI_NODATA seems to have been removed from RFC 3493 
and current Posix, but was apparently originally meant to be for looking up 
records that did exist but (say) did not have any IP v4 addresses.

----------
nosy: +nadeem.vawda

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25138>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to