[PATCH 3 of 4] py3: use socket.makefile() instead of dropped smtplib.SSLFakeFile

Denis Laxalde denis at laxalde.org
Thu Oct 10 15:47:30 EDT 2019


# HG changeset patch
# User Denis Laxalde <denis at laxalde.org>
# Date 1570735844 -7200
#      Thu Oct 10 21:30:44 2019 +0200
# Node ID 4439ff86e50d2d9c0ad63200cf22fa1c3461d3df
# Parent  134382b8c782147ab2fab155ebe79aa8df3b435c
py3: use socket.makefile() instead of dropped smtplib.SSLFakeFile

The latter (undocumented internal) class got removed in Python 3.3. Use
socket.makefile() as suggested:

  https://docs.python.org/3/whatsnew/3.3.html#porting-python-code

diff --git a/mercurial/mail.py b/mercurial/mail.py
index 519cc3b..0d2139b 100644
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -61,7 +61,7 @@ class STARTTLS(smtplib.SMTP):
                 ui=self._ui,
                 serverhostname=self._host,
             )
-            self.file = smtplib.SSLFakeFile(self.sock)
+            self.file = self.sock.makefile("rb")
             self.helo_resp = None
             self.ehlo_resp = None
             self.esmtp_features = {}



More information about the Mercurial-devel mailing list