[Python-modules-commits] [python-debiancontributors] 03/05: Deal with the input stream to the parser being a stream of bytes

Daniele Tricoli eriol-guest at moszumanska.debian.org
Tue Nov 15 00:19:26 UTC 2016


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

eriol-guest pushed a commit to branch master
in repository python-debiancontributors.

commit a0259a02cdc21dc9ea5da6ab722406c8415098a3
Author: Enrico Zini <enrico at enricozini.org>
Date:   Sat Jun 25 22:56:41 2016 +0200

    Deal with the input stream to the parser being a stream of bytes
---
 debiancontributors/parser.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/debiancontributors/parser.py b/debiancontributors/parser.py
index b1090d6..7378ec3 100644
--- a/debiancontributors/parser.py
+++ b/debiancontributors/parser.py
@@ -21,6 +21,7 @@ from __future__ import division
 from __future__ import unicode_literals
 import datetime
 import json
+import codecs
 import six
 
 class Fail(BaseException):
@@ -152,7 +153,8 @@ def get_json(f, compression=None):
             raise Fail(500, "{} compression is not supported".format(compression))
     else:
         try:
-            return json.load(f.decode("utf-8"))
+            reader = codecs.getreader("utf-8")
+            return json.load(reader(f))
         except (ValueError, UnicodeDecodeError):
             raise Fail(400, "invalid JSON data")
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-debiancontributors.git



More information about the Python-modules-commits mailing list