Patchwork D2149: py3: pass system string to email.message.Message.set_type()

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2018, 10:57 p.m.
Message ID <differential-rev-PHID-DREV-rklg6hn2t3gyfxqus3l7-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27593/
State Superseded
Headers show

Comments

phabricator - Feb. 11, 2018, 10:57 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Python 3 insists the type is a str.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/mail.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -20,6 +20,7 @@ 
 from . import (
     encoding,
     error,
+    pycompat,
     sslutil,
     util,
 )
@@ -218,7 +219,7 @@ 
     '''
     cs = email.charset.Charset(charset)
     msg = email.message.Message()
-    msg.set_type('text/' + subtype)
+    msg.set_type(pycompat.sysstr('text/' + subtype))
 
     for line in body.splitlines():
         if len(line) > 950: