[diffoscope] 04/05: comparators.json: fixup 7b8998e for py < 3.6: decode the input if we get that far to try a .load()

Mattia Rizzolo mattia at debian.org
Wed Feb 28 22:31:20 CET 2018


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository diffoscope.

commit 686f3afe446dd94043e86d93166433ed3a2a150c
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Wed Feb 28 21:17:42 2018 +0100

    comparators.json: fixup 7b8998e for py < 3.6: decode the input if we get that far to try a .load()
    
    Gbp-Dch: Ignore
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
 diffoscope/comparators/json.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/json.py b/diffoscope/comparators/json.py
index 17808ec..1066af9 100644
--- a/diffoscope/comparators/json.py
+++ b/diffoscope/comparators/json.py
@@ -46,8 +46,8 @@ class JSONFile(File):
                 f.seek(0)
 
             try:
-                file.parsed = json.load(
-                    f,
+                file.parsed = json.loads(
+                    f.read().decode('utf-8', errors='ignore'),
                     object_pairs_hook=collections.OrderedDict,
                 )
             except ValueError:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list