summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-16 02:35:47 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-16 02:35:47 (GMT)
commitee4cc698ca906c519054a85d119c76e757227e82 (patch)
tree6af7ef2bb20a9e32e86354878b29e3ef026ac366 /Objects
parentfc28e0de584e8040bd27080b0111a722243b82c7 (diff)
downloadcpython-ee4cc698ca906c519054a85d119c76e757227e82.zip
cpython-ee4cc698ca906c519054a85d119c76e757227e82.tar.gz
cpython-ee4cc698ca906c519054a85d119c76e757227e82.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/funcobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 59cb519..e514eeb 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -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");