changeset 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 33506cb43642
children 90ee1f61504e
files mercurial/mail.py
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
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: