Patchwork D7283: mail: suppress a pytype error that's just experimentally wrong

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 10:59 p.m.
Message ID <differential-rev-PHID-DREV-te4rvf3nxotre63lih7m-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42834/
State Superseded
Headers show

Comments

phabricator - Nov. 6, 2019, 10:59 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It's probably more correct to pass a str here, but I'm not going to
  worry about it for now.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/mail.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -279,7 +279,9 @@ 
     '''Return MIME message.
     Quoted-printable transfer encoding will be used if necessary.
     '''
-    cs = email.charset.Charset(charset)
+    # Experimentally charset is okay as a bytes even if the type
+    # stubs disagree.
+    cs = email.charset.Charset(charset)  # pytype: disable=wrong-arg-types
     msg = email.message.Message()
     msg.set_type(pycompat.sysstr(b'text/' + subtype))