Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r63522:6794e06515db
Date: 2013-04-20 07:51 -0700
http://bitbucket.org/pypy/pypy/changeset/6794e06515db/
Log: Fixed #1460 -- correct an issue with loading empty JSON objects when
using object_pairs_hook
diff --git a/lib-python/2.7/json/decoder.py b/lib-python/2.7/json/decoder.py
--- a/lib-python/2.7/json/decoder.py
+++ b/lib-python/2.7/json/decoder.py
@@ -162,7 +162,7 @@
if nextchar == '}':
if object_pairs_hook is not None:
result = object_pairs_hook(pairs)
- return result, end
+ return result, end + 1
pairs = {}
if object_hook is not None:
pairs = object_hook(pairs)
diff --git a/lib-python/2.7/json/tests/test_decode.py
b/lib-python/2.7/json/tests/test_decode.py
--- a/lib-python/2.7/json/tests/test_decode.py
+++ b/lib-python/2.7/json/tests/test_decode.py
@@ -44,6 +44,7 @@
object_pairs_hook=OrderedDict,
object_hook=lambda x: None),
OrderedDict(p))
+ self.assertEqual(self.loads("{}", object_pairs_hook=list), [])
class TestPyDecode(TestDecode, PyTest): pass
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit