Commits

Alex Gaynor committed 6794e06

Fixed #1460 -- correct an issue with loading empty JSON objects when using object_pairs_hook

  • Participants
  • Parent commits 40390dc

Comments (0)

Files changed (2)

lib-python/2.7/json/decoder.py

         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)

lib-python/2.7/json/tests/test_decode.py

                                     object_pairs_hook=OrderedDict,
                                     object_hook=lambda x: None),
                          OrderedDict(p))
+        self.assertEqual(self.loads("{}", object_pairs_hook=list), [])
 
 
 class TestPyDecode(TestDecode, PyTest): pass