diff -up cpython/Lib/imaplib.py.orig cpython/Lib/imaplib.py --- cpython/Lib/imaplib.py.orig 2013-07-24 10:58:29.690668562 +0200 +++ cpython/Lib/imaplib.py 2013-07-24 10:58:11.583605735 +0200 @@ -156,7 +156,7 @@ class IMAP4: class abort(error): pass # Service errors - close and retry class readonly(abort): pass # Mailbox status changed to READ-ONLY - def __init__(self, host = '', port = IMAP4_PORT): + def __init__(self, host = None, port = IMAP4_PORT): self.debug = Debug self.state = 'LOGOUT' self.literal = None # A literal argument to a command @@ -237,7 +237,7 @@ class IMAP4: def _create_socket(self): return socket.create_connection((self.host, self.port)) - def open(self, host = '', port = IMAP4_PORT): + def open(self, host = None, port = IMAP4_PORT): """Setup connection to remote server on "host:port" (default: localhost:standard IMAP4 port). This connection will be used by the routines: @@ -1188,7 +1188,7 @@ if HAVE_SSL: """ - def __init__(self, host='', port=IMAP4_SSL_PORT, keyfile=None, certfile=None, ssl_context=None): + def __init__(self, host=None, port=IMAP4_SSL_PORT, keyfile=None, certfile=None, ssl_context=None): if ssl_context is not None and keyfile is not None: raise ValueError("ssl_context and keyfile arguments are mutually " "exclusive") @@ -1208,7 +1208,7 @@ if HAVE_SSL: else: return ssl.wrap_socket(sock, self.keyfile, self.certfile) - def open(self, host='', port=IMAP4_SSL_PORT): + def open(self, host=None, port=IMAP4_SSL_PORT): """Setup connection to remote server on "host:port". (default: localhost:standard IMAP4 SSL port). This connection will be used by the routines: @@ -1444,7 +1444,7 @@ if __name__ == '__main__': stream_command = val if not args: args = (stream_command,) - if not args: args = ('',) + if not args: args = (None,) host = args[0]