[Python-checkins] CVS: python/dist/src/Objects funcobject.c,2.50,2.51

Guido van Rossum gvanrossum@users.sourceforge.net
Sun, 17 Mar 2002 19:09:08 -0800


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

Modified Files:
	funcobject.c 
Log Message:
Fix for SF bug 528132 (Armin Rigo): classmethod().__get__() segfault

The proper fix is not quite what was submitted; it's really better to
take the class of the object passed rather than calling PyMethod_New
with NULL pointer args, because that can then cause other core dumps
later.

I also added a testcase for the fix to classmethods() in test_descr.py.

I've already applied this to the 2.2 branch.


Index: funcobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v
retrieving revision 2.50
retrieving revision 2.51
diff -C2 -d -r2.50 -r2.51
*** funcobject.c	17 Dec 2001 11:39:56 -0000	2.50
--- funcobject.c	18 Mar 2002 03:09:06 -0000	2.51
***************
*** 475,478 ****
--- 475,480 ----
  		return NULL;
  	}
+ 	if (type == NULL)
+ 		type = (PyObject *)(obj->ob_type);
   	return PyMethod_New(cm->cm_callable,
  			    type, (PyObject *)(type->ob_type));