New submission from Matěj Stuchlík:
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! :)
----------
components: Library (Lib)
files: imaplib.patch
keywords: patch
messages: 193632
nosy: sYnfo
priority: normal
severity: normal
status: open
title: imaplib.IMAP4() ends with "Name or service not known" on Fedora 18
type: behavior
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file31027/imaplib.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18540>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com