D10168: mail: convert SMTPException to bytes before passing to error.Abort()

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Fri Mar 12 18:08:37 UTC 2021


mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Caught by pytype:
  
    File "/mnt/c/Users/Matt/hg/mercurial/mail.py", line 168, in _smtp: Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
             Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
      Actually passed: (self, message: smtplib.SMTPException)

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10168

AFFECTED FILES
  mercurial/mail.py

CHANGE DETAILS

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -165,7 +165,7 @@
         try:
             s.login(username, password)
         except smtplib.SMTPException as inst:
-            raise error.Abort(inst)
+            raise error.Abort(stringutil.forcebytestr(inst))
 
     def send(sender, recipients, msg):
         try:



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list