This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ned.deily
Recipients James Crowther, ned.deily
Date 2017-03-03.00:41:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488501673.57.0.239287963128.issue29705@psf.upfronthosting.co.za>
In-reply-to
Content
Sorry, I can't reproduce that behavior with my macOS 10.12, 10.11, or 10.10 systems if the hostname is a valid string including "localhost".  If the string is empty or hostname is None, then I see Errno 8.

$ /usr/local/bin/python3.6
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> hostname = 'python.org'
>>> socket.getaddrinfo(hostname, None)
[(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('23.253.135.79', 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('23.253.135.79', 0)), (<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('2001:4802:7901::e60a:1375:0:6', 0, 0, 0)), (<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('2001:4802:7901::e60a:1375:0:6', 0, 0, 0))]
>>> hostname = "localhost"
>>> socket.getaddrinfo(hostname, None)
[(<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('::1', 0, 0, 0)), (<AddressFamily.AF_INET6: 30>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::1', 0, 0, 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('127.0.0.1', 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 0))]
>>> hostname = ""
>>> socket.getaddrinfo(hostname, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 743, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Perhaps there is something different about your hostname configuration on your Mac?  macOS has some unusual ways of configuring the hostname resolutions.  I don't have time at the moment to investigate further.  But Python's socket module interfaces tend to be very thin wrappers around the underlying OS provided APIs.  Perhaps you could test with a small C program that does the equivalent.
History
Date User Action Args
2017-03-03 00:41:13ned.deilysetrecipients: + ned.deily, James Crowther
2017-03-03 00:41:13ned.deilysetmessageid: <1488501673.57.0.239287963128.issue29705@psf.upfronthosting.co.za>
2017-03-03 00:41:13ned.deilylinkissue29705 messages
2017-03-03 00:41:13ned.deilycreate