mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple
parses nested mutating sequence.
This commit is contained in:
parent
64359d203e
commit
19c4e0df29
7 changed files with 118 additions and 15 deletions
|
@ -254,10 +254,10 @@ partial_reduce(partialobject *pto, PyObject *unused)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
partial_setstate(partialobject *pto, PyObject *args)
|
||||
partial_setstate(partialobject *pto, PyObject *state)
|
||||
{
|
||||
PyObject *fn, *fnargs, *kw, *dict;
|
||||
if (!PyArg_ParseTuple(args, "(OOOO):__setstate__",
|
||||
if (!PyArg_ParseTuple(state, "OOOO",
|
||||
&fn, &fnargs, &kw, &dict))
|
||||
return NULL;
|
||||
Py_XDECREF(pto->fn);
|
||||
|
@ -281,7 +281,7 @@ partial_setstate(partialobject *pto, PyObject *args)
|
|||
|
||||
static PyMethodDef partial_methods[] = {
|
||||
{"__reduce__", (PyCFunction)partial_reduce, METH_NOARGS},
|
||||
{"__setstate__", (PyCFunction)partial_setstate, METH_VARARGS},
|
||||
{"__setstate__", (PyCFunction)partial_setstate, METH_O},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue