[diffoscope] 02/07: comparators.json: Catch bad JSON errors on Python pre-3.5. (Closes: #855233)

Mattia Rizzolo mattia at debian.org
Sun Feb 26 17:38:00 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 eafaa8eecd13b2fb9e8c0631fd1428c6dd5456e2
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. (Closes: #855233)
    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