Mercurial > public > mercurial-scm > hg-stable
diff hgext/lfs/blobstore.py @ 43380:579672b347d2 stable
py3: define and use json.loads polyfill
Python 3.5's json.loads() requires a str. Only Python 3.6+
supports passing a bytes or bytearray.
This commit implements a json.loads() polyfill on Python 3.5
so that we can use bytes. The added function to detect encodings
comes verbatim from Python 3.7.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 02 Nov 2019 12:09:35 -0700 |
parents | 127cc1f72e70 |
children | 9f70512ae2cf |
line wrap: on
line diff
--- a/hgext/lfs/blobstore.py Sat Nov 02 11:48:38 2019 -0700 +++ b/hgext/lfs/blobstore.py Sat Nov 02 12:09:35 2019 -0700 @@ -363,7 +363,7 @@ _(b'LFS error: %s') % _urlerrorreason(ex), hint=hint ) try: - response = json.loads(rawjson) + response = pycompat.json_loads(rawjson) except ValueError: raise LfsRemoteError( _(b'LFS server returns invalid JSON: %s')