[Python-checkins] r50681 - python/trunk/Objects/funcobject.c
neal.norwitz
python-checkins at python.org
Sun Jul 16 04:35:47 CEST 2006
Author: neal.norwitz
Date: Sun Jul 16 04:35:47 2006
New Revision: 50681
Modified:
python/trunk/Objects/funcobject.c
Log:
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.
Modified: python/trunk/Objects/funcobject.c
==============================================================================
--- python/trunk/Objects/funcobject.c (original)
+++ python/trunk/Objects/funcobject.c Sun Jul 16 04:35:47 2006
@@ -109,8 +109,8 @@
}
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");
More information about the Python-checkins
mailing list