py3: decode encoding literal before passing to .decode() stable
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 24 Oct 2019 14:28:20 +0200
branchstable
changeset 43330 910827a2cb20
parent 43329 33506cb43642
child 43331 90ee1f61504e
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.
mercurial/mail.py
--- 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: