diff mercurial/mail.py @ 43330:910827a2cb20 stable

py3: decode encoding literal before passing to .decode() bytes.decode(<encoding>) wants an str as "encoding" parameter, it raises a TypeError if given a bytestring. encoding.encoding and encoding.fallbackencoding are bytes values.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Thu, 24 Oct 2019 14:28:20 +0200
parents ef81de93143e
children fdc3af52305b
line wrap: on
line diff
--- a/mercurial/mail.py	Thu Oct 24 16:34:43 2019 +0200
+++ b/mercurial/mail.py	Thu Oct 24 14:28:20 2019 +0200
@@ -342,6 +342,7 @@
         s.decode('ascii')
     except UnicodeDecodeError:
         for ics in (encoding.encoding, encoding.fallbackencoding):
+            ics = pycompat.sysstr(ics)
             try:
                 u = s.decode(ics)
             except UnicodeDecodeError: