summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-05-07 15:29:14 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2011-05-07 15:29:14 (GMT)
commit9c18778695ab002789849e385eeb9d270633a5c6 (patch)
tree9fc84b56a53f9814f9907d01eba281dbccd03e8e /Modules
parentdbf04540827ea64859f718b45fc06176a13f9134 (diff)
parent06383ee090e3c66130db9dc0b562fba3cb749be1 (diff)
downloadcpython-9c18778695ab002789849e385eeb9d270633a5c6.zip
cpython-9c18778695ab002789849e385eeb9d270633a5c6.tar.gz
cpython-9c18778695ab002789849e385eeb9d270633a5c6.tar.bz2
#12017: merge with 3.2.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_json.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 9177094..0f9c00e 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -943,6 +943,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) {
@@ -957,10 +958,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') {