mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
#12051: merge with 3.1.
This commit is contained in:
commit
f188bc5d46
3 changed files with 38 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue