diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -509,6 +509,8 @@ NB: 'password' will be quoted. """ + if isinstance(password, str): + password = bytes(password, "ASCII") typ, dat = self._simple_command('LOGIN', user, self._quote(password)) if typ != 'OK': raise self.error(dat[-1])