[Python-checkins] python/dist/src/Objects funcobject.c,2.62,2.63

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Tue, 17 Jun 2003 18:13:43 -0700


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

Modified Files:
	funcobject.c 
Log Message:
SF bug #753451: classmethod abuse --> SystemError

Check the argument to classmethod for callability.

Backport candidate.



Index: funcobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v
retrieving revision 2.62
retrieving revision 2.63
diff -C2 -d -r2.62 -r2.63
*** funcobject.c	6 May 2003 09:01:41 -0000	2.62
--- funcobject.c	18 Jun 2003 01:13:41 -0000	2.63
***************
*** 641,644 ****
--- 641,650 ----
  	if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &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;