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 <>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/", line 163, in __init__, port)
  File "/usr/lib64/python2.7/", line 229, in open
    self.sock = socket.create_connection((host, port))
  File "/usr/lib64/python2.7/", 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: 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 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! :)
Date User Action Args
2013-07-24 09:19:31sYnfosetrecipients: + sYnfo
2013-07-24 09:19:31sYnfosetmessageid: <>
2013-07-24 09:19:31sYnfolinkissue18540 messages
2013-07-24 09:19:30sYnfocreate