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.
This commit is contained in:
parent
fc28e0de58
commit
ee4cc698ca
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue