# HG changeset patch # User Denis Laxalde # Date 1570736232 -7200 # Node ID 9145abd8b96d6d8538772e80e61b65b1e2fbbdb2 # Parent 54b06bec8914b72b2cad71e59d4abea03b49703c py3: decode username and password before SMTP login smtplib.SMTP.login() requires str on Python 3. For 'password', we only need to decode when value comes from config as getpass() returns the correct type already. diff -r 54b06bec8914 -r 9145abd8b96d mercurial/mail.py --- a/mercurial/mail.py Thu Oct 10 21:30:44 2019 +0200 +++ b/mercurial/mail.py Thu Oct 10 21:37:12 2019 +0200 @@ -145,10 +145,14 @@ sslutil.validatesocket(s.sock) username = ui.config(b'smtp', b'username') password = ui.config(b'smtp', b'password') - if username and not password: - password = ui.getpass() + if username: + if password: + password = encoding.strfromlocal(password) + else: + password = ui.getpass() if username and password: ui.note(_(b'(authenticating to mail server as %s)\n') % username) + username = encoding.strfromlocal(username) try: s.login(username, password) except smtplib.SMTPException as inst: