summaryrefslogtreecommitdiffstats
path: root/Lib/imaplib.py
diff options
context:
space:
mode:
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"