mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
Issue #24683: Fixed crashes in _json functions called with arguments of
inappropriate type.
This commit is contained in:
commit
f002225f7e
3 changed files with 19 additions and 2 deletions
|
@ -1344,11 +1344,19 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
assert(PyEncoder_Check(self));
|
||||
s = (PyEncoderObject *)self;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOOOOOp:make_encoder", kwlist,
|
||||
&markers, &defaultfn, &encoder, &indent, &key_separator, &item_separator,
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOUUOOp:make_encoder", kwlist,
|
||||
&markers, &defaultfn, &encoder, &indent,
|
||||
&key_separator, &item_separator,
|
||||
&sort_keys, &skipkeys, &allow_nan))
|
||||
return -1;
|
||||
|
||||
if (markers != Py_None && !PyDict_Check(markers)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"make_encoder() argument 1 must be dict or None, "
|
||||
"not %.200s", Py_TYPE(markers)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
s->markers = markers;
|
||||
s->defaultfn = defaultfn;
|
||||
s->encoder = encoder;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue