py3: call SMTP.has_extn() with an str
authorDenis Laxalde <denis@laxalde.org>
Thu, 10 Oct 2019 21:00:13 +0200
changeset 43169 3941e7063d03
parent 43168 01e8eefd9434
child 43170 a1801ee97840
py3: call SMTP.has_extn() with an str Passing a bytes on Python 3 always returns False, thus starttls is not properly detected.
mercurial/mail.py
--- a/mercurial/mail.py	Thu Oct 10 20:27:34 2019 +0200
+++ b/mercurial/mail.py	Thu Oct 10 21:00:13 2019 +0200
@@ -49,7 +49,7 @@
         self._host = host
 
     def starttls(self, keyfile=None, certfile=None):
-        if not self.has_extn(b"starttls"):
+        if not self.has_extn("starttls"):
             msg = b"STARTTLS extension not supported by server"
             raise smtplib.SMTPException(msg)
         (resp, reply) = self.docmd(b"STARTTLS")