Patchwork D6961: py3: fix phabricator's use of json.loads() for py3.5

login
register
mail settings
Submitter phabricator
Date Oct. 4, 2019, 5:59 p.m.
Message ID <759f84bef30901f899cd9c4a2e491838@localhost.localdomain>
Download mbox | patch
Permalink /patch/41956/
State Not Applicable
Headers show

Comments

phabricator - Oct. 4, 2019, 5:59 p.m.
Closed by commit rHG0f90c2d2d7e8: py3: fix phabricator&#039;s use of json.loads() for py3.5 (authored by Kwan).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6961?vs=16799&id=16801

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6961/new/

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: Kwan, #hg-reviewers
Cc: mjpieters, mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -251,7 +251,8 @@ 
     parsed = pycompat.rapply(
         lambda x: encoding.unitolocal(x) if isinstance(x, pycompat.unicode)
         else x,
-        json.loads(body)
+        # json.loads only accepts bytes from py3.6+
+        json.loads(encoding.unifromlocal(body))
     )
     if parsed.get(b'error_code'):
         msg = (_(b'Conduit Error (%s): %s')