[diffoscope] 01/01: comparators.json: Catch bad JSON errors on Python pre-3.5.

Mattia Rizzolo mattia at debian.org
Wed Feb 15 20:53:45 CET 2017

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

mattia pushed a commit to branch master
in repository diffoscope.

commit 31a52f1fafd28b946593847f892d3909dbfd6293
Author: Brett Smith <brettcsmith at brettcsmith.org>
Date:   Wed Feb 15 14:39:41 2017 -0500

    comparators.json: Catch bad JSON errors on Python pre-3.5.
    json.JSONDecodeError was introduced in Python 3.5.  Earlier versions raised
    ValueError, which is the base class of JSONDecodeError.  Catch that instead.
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
 diffoscope/comparators/json.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diffoscope/comparators/json.py b/diffoscope/comparators/json.py
index d46c830..943ec64 100644
--- a/diffoscope/comparators/json.py
+++ b/diffoscope/comparators/json.py
@@ -37,7 +37,7 @@ class JSONFile(File):
         with open(file.path) as f:
                 file.parsed = json.load(f, object_pairs_hook=collections.OrderedDict)
-            except json.JSONDecodeError:
+            except ValueError:
                 return False
         return True

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

More information about the diffoscope mailing list