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

mwh at users.sourceforge.net mwh at users.sourceforge.net
Thu Mar 31 12:22:45 CEST 2005


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

Modified Files:
      Tag: release24-maint
	classobject.c 
Log Message:
Backport:

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.176.2.1
diff -u -d -r2.176 -r2.176.2.1
--- classobject.c	23 Sep 2004 02:39:36 -0000	2.176
+++ classobject.c	31 Mar 2005 10:22:42 -0000	2.176.2.1
@@ -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