summaryrefslogtreecommitdiffstats
path: root/Modules/_json.c
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-05-10 22:23:41 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2011-05-10 22:23:41 (GMT)
commitf8d6fd605dafe63300ecdf77353d4a3bac02e362 (patch)
tree3d19ff680d0e9b9209a5e1f6b30a35168cafe050 /Modules/_json.c
parent1947477072c22760ad324cf571d36cccc3fc1213 (diff)
parentf188bc5d4618103bd86a49a6b473e4a86e6b22b7 (diff)
downloadcpython-f8d6fd605dafe63300ecdf77353d4a3bac02e362.zip
cpython-f8d6fd605dafe63300ecdf77353d4a3bac02e362.tar.gz
cpython-f8d6fd605dafe63300ecdf77353d4a3bac02e362.tar.bz2
#12051: merge with 3.2.
Diffstat (limited to 'Modules/_json.c')
-rw-r--r--Modules/_json.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 0f9c00e..a392c97 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1354,10 +1354,18 @@ encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssi
return _steal_list_append(rval, encoded);
}
else if (PyList_Check(obj) || PyTuple_Check(obj)) {
- return encoder_listencode_list(s, rval, obj, indent_level);
+ if (Py_EnterRecursiveCall(" while encoding a JSON object"))
+ return -1;
+ rv = encoder_listencode_list(s, rval, obj, indent_level);
+ Py_LeaveRecursiveCall();
+ return rv;
}
else if (PyDict_Check(obj)) {
- return encoder_listencode_dict(s, rval, obj, indent_level);
+ if (Py_EnterRecursiveCall(" while encoding a JSON object"))
+ return -1;
+ rv = encoder_listencode_dict(s, rval, obj, indent_level);
+ Py_LeaveRecursiveCall();
+ return rv;
}
else {
PyObject *ident = NULL;
@@ -1383,7 +1391,12 @@ encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssi
Py_XDECREF(ident);
return -1;
}
+
+ if (Py_EnterRecursiveCall(" while encoding a JSON object"))
+ return -1;
rv = encoder_listencode_obj(s, rval, newobj, indent_level);
+ Py_LeaveRecursiveCall();
+
Py_DECREF(newobj);
if (rv) {
Py_XDECREF(ident);