[Python-checkins] CVS: python/dist/src/Modules newmodule.c,2.37,2.38

Guido van Rossum gvanrossum@users.sourceforge.net
Tue, 15 Jan 2002 11:20:06 -0800


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

Modified Files:
	newmodule.c 
Log Message:
There's no need for typechecks on the second and third argument of
new.instancemethod() -- the instancemethod object is now a perfectly
general container.

This fixes SF bug ##503091 (Pedro Rodriquez): new.instancemethod fails
for new classes

This is a 2.2.1 candidate.


Index: newmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/newmodule.c,v
retrieving revision 2.37
retrieving revision 2.38
diff -C2 -d -r2.37 -r2.38
*** newmodule.c	2001/11/13 20:11:55	2.37
--- newmodule.c	2002/01/15 19:20:03	2.38
***************
*** 41,48 ****
  	PyObject* classObj;
  
! 	if (!PyArg_ParseTuple(args, "OOO!:instancemethod",
! 			      &func,
! 			      &self,
! 			      &PyClass_Type, &classObj))
  		return NULL;
  	if (!PyCallable_Check(func)) {
--- 41,46 ----
  	PyObject* classObj;
  
! 	if (!PyArg_ParseTuple(args, "OOO:instancemethod",
! 			      &func, &self, &classObj))
  		return NULL;
  	if (!PyCallable_Check(func)) {
***************
*** 53,61 ****
  	if (self == Py_None)
  		self = NULL;
- 	else if (!PyInstance_Check(self)) {
- 		PyErr_SetString(PyExc_TypeError,
- 				"second argument must be instance or None");
- 		return NULL;
- 	}
  	return PyMethod_New(func, self, classObj);
  }
--- 51,54 ----