[Python-checkins] python/dist/src/Objects classobject.c, 2.176, 2.177

mwh at users.sourceforge.net mwh at users.sourceforge.net
Wed Mar 30 18:32:17 CEST 2005


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23002/Objects

Modified Files:
	classobject.c 
Log Message:
Fix for rather inaccurately titled bug

[ 1165306 ] Property access with decorator makes interpreter crash

Don't allow the creation of unbound methods with NULL im_class, because
attempting to call such crashes.

Backport candidate.


Index: classobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v
retrieving revision 2.176
retrieving revision 2.177
diff -u -d -r2.176 -r2.177
--- classobject.c	23 Sep 2004 02:39:36 -0000	2.176
+++ classobject.c	30 Mar 2005 16:32:10 -0000	2.177
@@ -2208,6 +2208,12 @@
 	}
 	if (self == Py_None)
 		self = NULL;
+	if (self == NULL && classObj == NULL) {
+		PyErr_SetString(PyExc_TypeError,
+			"unbound methods must have non-NULL im_class");
+		return NULL;
+	}
+
 	return PyMethod_New(func, self, classObj);
 }
 



More information about the Python-checkins mailing list