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 sYnfo
Recipients sYnfo
Date 2013-07-24.09:19:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374657571.18.0.17831195671.issue18540@psf.upfronthosting.co.za>
In-reply-to
Content
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/imaplib.py", line 163, in __init__
    self.open(host, port)
  File "/usr/lib64/python2.7/imaplib.py", line 229, in open
    self.sock = socket.create_connection((host, port))
  File "/usr/lib64/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

Steps to Reproduce:
1. run python interpreter
2. import imaplib
3. imaplib.IMAP4()

Expected behavior would be, as per documentation, for imaplib to try to connect to localhost.

The root cause is, I believe, this:

socket.py::create_connection states "An host of '' [...] tells the OS to use the default." and thus imaplib uses '' as the default value for host, however from getaddrinfo (to which function the host variable is passed) documentation and source it seems to me that it expect None, not '' as the default value.

Substituting '' for None as the default value for host in imaplib.py seems to resolve this issue, I've included a tentative patch that does just that.

In case this will need patching I'd be more than happy to work on a more complete patch! :)
History
Date User Action Args
2013-07-24 09:19:31sYnfosetrecipients: + sYnfo
2013-07-24 09:19:31sYnfosetmessageid: <1374657571.18.0.17831195671.issue18540@psf.upfronthosting.co.za>
2013-07-24 09:19:31sYnfolinkissue18540 messages
2013-07-24 09:19:30sYnfocreate