[PATCH 1 of 4] py3: call SMTP.has_extn() with an str

Denis Laxalde denis at laxalde.org
Thu Oct 10 19:47:28 UTC 2019


# HG changeset patch
# User Denis Laxalde <denis at laxalde.org>
# Date 1570734013 -7200
#      Thu Oct 10 21:00:13 2019 +0200
# Node ID 55a0f0c84fdc2170047ea99f71bfac60e3ea4b50
# Parent  a5b04863dbff8c9a0966ee47c8a27675bdcdf2b8
py3: call SMTP.has_extn() with an str

Passing a bytes on Python 3 always returns False, thus starttls is not
properly detected.

diff --git a/mercurial/mail.py b/mercurial/mail.py
index e67603a..675207a 100644
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -49,7 +49,7 @@ class STARTTLS(smtplib.SMTP):
         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")



More information about the Mercurial-devel mailing list