Patchwork D3279: py3: make sure decode() first argument is str

login
register
mail settings
Submitter phabricator
Date April 13, 2018, 1:13 p.m.
Message ID <6c479abc79eead6a76097d49bbb6490c@localhost.localdomain>
Download mbox | patch
Permalink /patch/30854/
State Not Applicable
Headers show

Comments

phabricator - April 13, 2018, 1:13 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbfdd20d22a86: py3: make sure decode() first argument is str (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3279?vs=8046&id=8112

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

AFFECTED FILES
  hgext/convert/common.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/convert/common.py b/hgext/convert/common.py
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -217,12 +217,13 @@ 
         if isinstance(s, unicode):
             return s.encode("utf-8")
         try:
-            return s.decode(encoding).encode("utf-8")
+            return s.decode(pycompat.sysstr(encoding)).encode("utf-8")
         except UnicodeError:
             try:
                 return s.decode("latin-1").encode("utf-8")
             except UnicodeError:
-                return s.decode(encoding, "replace").encode("utf-8")
+                return s.decode(pycompat.sysstr(encoding),
+                                "replace").encode("utf-8")
 
     def getchangedfiles(self, rev, i):
         """Return the files changed by rev compared to parent[i].