mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
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
1 changed files with 2 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue