summaryrefslogtreecommitdiffstats
path: root/Lib/json/decoder.py
diff options
context:
space:
mode:
authorEzio Melotti <none@none>2011-04-13 04:10:13 (GMT)
committerEzio Melotti <none@none>2011-04-13 04:10:13 (GMT)
commitd210aa1ad9329661625ca5f0b6754f84ffc25021 (patch)
tree5d815eb2189614154b9c6cd37c32215fd9281dcc /Lib/json/decoder.py
parent42368f9b0cd9e9b00d617e7a52619b82b0101b3f (diff)
downloadcpython-d210aa1ad9329661625ca5f0b6754f84ffc25021.zip
cpython-d210aa1ad9329661625ca5f0b6754f84ffc25021.tar.gz
cpython-d210aa1ad9329661625ca5f0b6754f84ffc25021.tar.bz2
#9233: Fix json.loads({}) to return a dict (instead of a list), when _json is not available.
Diffstat (limited to 'Lib/json/decoder.py')
-rw-r--r--Lib/json/decoder.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py
index 7b3d7d5..12fa815 100644
--- a/Lib/json/decoder.py
+++ b/Lib/json/decoder.py
@@ -161,6 +161,12 @@ def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook,
nextchar = s[end:end + 1]
# Trivial empty object
if nextchar == '}':
+ if object_pairs_hook is not None:
+ result = object_pairs_hook(pairs)
+ return result, end
+ pairs = {}
+ if object_hook is not None:
+ pairs = object_hook(pairs)
return pairs, end + 1
elif nextchar != '"':
raise ValueError(errmsg("Expecting property name", s, end))