[Python-checkins] python/dist/src/Objects funcobject.c,2.50.4.3,2.50.4.4

anthonybaxter@users.sourceforge.net anthonybaxter@users.sourceforge.net
Sun, 13 Jul 2003 06:54:36 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv30506/Objects

Modified Files:
      Tag: release22-maint
	funcobject.c 
Log Message:
Backport of rhettinger's funcobject.c 2.63, bugfix for SF bug 753451
Check the argument of classmethod is callable. (prevents 
classmethod(classmethod(func)) from bombing out.


Index: funcobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v
retrieving revision 2.50.4.3
retrieving revision 2.50.4.4
diff -C2 -d -r2.50.4.3 -r2.50.4.4
*** funcobject.c	22 May 2003 18:11:20 -0000	2.50.4.3
--- funcobject.c	13 Jul 2003 13:54:34 -0000	2.50.4.4
***************
*** 612,615 ****
--- 612,621 ----
  	if (!PyArg_ParseTuple(args, "O:callable", &callable))
  		return -1;
+ 	if (!PyCallable_Check(callable)) {
+ 		PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
+ 		     callable->ob_type->tp_name);
+ 		return -1;
+ 	}
+ 	
  	Py_INCREF(callable);
  	cm->cm_callable = callable;