Commit 381407f3 authored by Neal Norwitz's avatar Neal Norwitz

PyFunction_SetDefaults() is documented as taking None or a tuple.

A NULL would crash the PyTuple_Check().  Now make NULL return a SystemError.

Reported by Klocwork #73.
parent b5dc6e92
......@@ -109,8 +109,8 @@ PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
}
if (defaults == Py_None)
defaults = NULL;
else if (PyTuple_Check(defaults)) {
Py_XINCREF(defaults);
else if (defaults && PyTuple_Check(defaults)) {
Py_INCREF(defaults);
}
else {
PyErr_SetString(PyExc_SystemError, "non-tuple default args");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment