py3: fix phabricator's use of json.loads() for py3.5
authorIan Moody <moz-ian@perix.co.uk>
Fri, 04 Oct 2019 18:33:54 +0100
changeset 43047 0f90c2d2d7e8
parent 43046 e360acfaf210
child 43048 c348d829d23a
py3: fix phabricator's use of json.loads() for py3.5 Missed this in c340a8ac7ef3 since `loads()` takes bytes from 3.6 onwards. Differential Revision: https://phab.mercurial-scm.org/D6961
hgext/phabricator.py
--- a/hgext/phabricator.py	Fri Oct 04 18:18:38 2019 +0100
+++ b/hgext/phabricator.py	Fri Oct 04 18:33:54 2019 +0100
@@ -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')