#12051: merge with 3.1.

This commit is contained in:
Ezio Melotti 2011-05-11 01:10:27 +03:00
commit f188bc5d46
3 changed files with 38 additions and 3 deletions

View file

@ -1338,10 +1338,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;
@ -1367,7 +1375,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);