py3: cast decode() argument to system string
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 11 Feb 2018 18:47:19 -0800
changeset 36118 9e47bfbeb723
parent 36117 c02771617a70
child 36119 6ea7f1c10c81
py3: cast decode() argument to system string The actual types here may be mixed due to string literals and variables from other modules. So a cast is necessary. Differential Revision: https://phab.mercurial-scm.org/D2166
mercurial/mail.py
--- a/mercurial/mail.py	Sun Feb 11 16:56:29 2018 -0800
+++ b/mercurial/mail.py	Sun Feb 11 18:47:19 2018 -0800
@@ -206,7 +206,7 @@
         return mimetextqp(s, subtype, 'us-ascii')
     for charset in cs:
         try:
-            s.decode(charset)
+            s.decode(pycompat.sysstr(charset))
             return mimetextqp(s, subtype, codec2iana(charset))
         except UnicodeDecodeError:
             pass