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

login
register
mail settings
Submitter phabricator
Date Oct. 4, 2019, 5:39 p.m.
Message ID <differential-rev-PHID-DREV-kmwdtfhvpnlj4nkcp3vi-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41954/
State Superseded
Headers show

Comments

phabricator - Oct. 4, 2019, 5:39 p.m.
Kwan created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Missed this in c340a8ac7ef3 <https://phab.mercurial-scm.org/rHGc340a8ac7ef38f88b48796c6add58b3a541cb4e8> since `loads()` takes bytes from 3.6 onwards.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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')