summaryrefslogtreecommitdiffstats
path: root/Lib/imaplib.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2018-08-07 02:12:18 (GMT)
committerGitHub <noreply@github.com>2018-08-07 02:12:18 (GMT)
commite4dcbbd7f4ac18d01c0ec85f64ae98b8281ed403 (patch)
treec1d8a7e7689aeb7add213b4f289161dbfdff2c81 /Lib/imaplib.py
parent3c1b590472d567e22a607ba31271865cd90c8e9b (diff)
downloadcpython-e4dcbbd7f4ac18d01c0ec85f64ae98b8281ed403.zip
cpython-e4dcbbd7f4ac18d01c0ec85f64ae98b8281ed403.tar.gz
cpython-e4dcbbd7f4ac18d01c0ec85f64ae98b8281ed403.tar.bz2
bpo-18540: Fix EAI_NONAME in imaplib.IMAP4*() (GH-8634)
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r--Lib/imaplib.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index 0dfd852..e451413 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -282,7 +282,11 @@ class IMAP4:
def _create_socket(self):
- return socket.create_connection((self.host, self.port))
+ # Default value of IMAP4.host is '', but socket.getaddrinfo()
+ # (which is used by socket.create_connection()) expects None
+ # as a default value for host.
+ host = None if not self.host else self.host
+ return socket.create_connection((host, self.port))
def open(self, host = '', port = IMAP4_PORT):
"""Setup connection to remote server on "host:port"