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

Chris Lamb chris at chris-lamb.co.uk
Sat Feb 18 01:03:05 CET 2017

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

lamby pushed a commit to branch experimental
in repository diffoscope.

commit b04dcd970ace6de56fb164e0ee59de6f5a49c2cb
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