From patchwork Fri Oct 4 17:39:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D6961: py3: fix phabricator's use of json.loads() for py3.5 From: phabricator X-Patchwork-Id: 41954 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Fri, 4 Oct 2019 17:39:05 +0000 Kwan created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Missed this in c340a8ac7ef3 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 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')