[Python-checkins] r52192 - python/branches/release24-maint/Objects/funcobject.c

andrew.kuchling python-checkins at python.org
Thu Oct 5 21:38:18 CEST 2006


Author: andrew.kuchling
Date: Thu Oct  5 21:38:17 2006
New Revision: 52192

Modified:
   python/branches/release24-maint/Objects/funcobject.c
Log:
[Backport r50681 | 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.


Modified: python/branches/release24-maint/Objects/funcobject.c
==============================================================================
--- python/branches/release24-maint/Objects/funcobject.c	(original)
+++ python/branches/release24-maint/Objects/funcobject.c	Thu Oct  5 21:38:17 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