diff options
| author | Ezio Melotti <none@none> | 2011-04-13 02:37:29 (GMT) |
|---|---|---|
| committer | Ezio Melotti <none@none> | 2011-04-13 02:37:29 (GMT) |
| commit | 2b96f0987ac966ef9ac037610da6b5b7e3996af6 (patch) | |
| tree | 968a3101cc04d5f8909df6f75d9dd7623c46f904 /Lib/json/decoder.py | |
| parent | 179816df59744313693d21525046d1d38af9119c (diff) | |
| download | cpython-2b96f0987ac966ef9ac037610da6b5b7e3996af6.zip cpython-2b96f0987ac966ef9ac037610da6b5b7e3996af6.tar.gz cpython-2b96f0987ac966ef9ac037610da6b5b7e3996af6.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.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py index b9745f7..eeebf45 100644 --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -161,6 +161,12 @@ def JSONObject(s_and_end, encoding, strict, scan_once, object_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)) |
