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

login
register
mail settings
Submitter phabricator
Date March 12, 2021, 6:08 p.m.
Message ID <differential-rev-PHID-DREV-rhemzv2kdpainn5uktk7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48482/
State Superseded
Headers show

Comments

phabricator - March 12, 2021, 6:08 p.m.
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




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

Patch

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: