comparison mercurial/mail.py @ 39026:a5e70c14214a

mail: stop using the smtplib.SSLFakeFile and use socket.socket.makefile They're equivalent, and the latter is what Python 3.3 says to use in the release notes. Turns out it works on Python 2 as well. Differential Revision: https://phab.mercurial-scm.org/D3956
author Augie Fackler <augie@google.com>
date Mon, 16 Jul 2018 18:17:19 -0400
parents 569d662816de
children 713126389ef2
comparison
equal deleted inserted replaced
39025:569d662816de 39026:a5e70c14214a
77 new_socket = socket.create_connection((host, port), timeout) 77 new_socket = socket.create_connection((host, port), timeout)
78 new_socket = sslutil.wrapsocket(new_socket, 78 new_socket = sslutil.wrapsocket(new_socket,
79 self.keyfile, self.certfile, 79 self.keyfile, self.certfile,
80 ui=self._ui, 80 ui=self._ui,
81 serverhostname=self._host) 81 serverhostname=self._host)
82 self.file = smtplib.SSLFakeFile(new_socket) 82 self.file = new_socket.makefile(r'rb')
83 return new_socket 83 return new_socket
84 84
85 def _pyhastls(): 85 def _pyhastls():
86 """Returns true iff Python has TLS support, false otherwise.""" 86 """Returns true iff Python has TLS support, false otherwise."""
87 try: 87 try: