mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-18540: Fix EAI_NONAME in imaplib.IMAP4*() (GH-8634)
This commit is contained in:
parent
3c1b590472
commit
e4dcbbd7f4
3 changed files with 22 additions and 1 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue