Patchwork D10473: mail: force SMTPException to bytes before wrapping in error.Abort

login
register
mail settings
Submitter phabricator
Date April 20, 2021, 1:08 a.m.
Message ID <differential-rev-PHID-DREV-u6b7spderuk5u52lunox-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48790/
State Superseded
Headers show

Comments

phabricator - April 20, 2021, 1:08 a.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Pytype wasn't complaining about this for some reason, but PyCharm was and we
  already handle another instance of this exception the same way in this function.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -164,7 +164,7 @@ 
             recipients = [r[1] for r in inst.recipients.values()]
             raise error.Abort(b'\n' + b'\n'.join(recipients))
         except smtplib.SMTPException as inst:
-            raise error.Abort(inst)
+            raise error.Abort(stringutil.forcebytestr(inst))
 
     return send