diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-05-07 15:15:34 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-05-07 15:15:34 (GMT) |
commit | 06383ee090e3c66130db9dc0b562fba3cb749be1 (patch) | |
tree | 911f4ebf7e1e6c4e25e7d24bf39925f6ba156f75 /Modules | |
parent | b0b0579625defd7ec370680075fb8ce46db4cd20 (diff) | |
parent | 362b95102f76d042e7f3865c1ebec5d36c79959a (diff) | |
download | cpython-06383ee090e3c66130db9dc0b562fba3cb749be1.zip cpython-06383ee090e3c66130db9dc0b562fba3cb749be1.tar.gz cpython-06383ee090e3c66130db9dc0b562fba3cb749be1.tar.bz2 |
#12017: merge with 3.1.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_json.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Modules/_json.c b/Modules/_json.c index 75b14ee..dd71003 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -927,6 +927,7 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_ Returns a new PyObject representation of the term. */ + PyObject *res; Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); Py_ssize_t length = PyUnicode_GET_SIZE(pystr); if (idx >= length) { @@ -941,10 +942,20 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_ next_idx_ptr); case '{': /* object */ - return _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr); + if (Py_EnterRecursiveCall(" while decoding a JSON object " + "from a unicode string")) + return NULL; + res = _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr); + Py_LeaveRecursiveCall(); + return res; case '[': /* array */ - return _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr); + if (Py_EnterRecursiveCall(" while decoding a JSON array " + "from a unicode string")) + return NULL; + res = _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr); + Py_LeaveRecursiveCall(); + return res; case 'n': /* null */ if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') { |