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

Michael Hudson mwh@users.sourceforge.net
Mon, 28 Jan 2002 07:03:38 -0800


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

Modified Files:
      Tag: release22-maint
	newmodule.c 
Log Message:
It's merge time!

Backport gvanrossum's checkin of revision 2.38:

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.37.8.1
diff -C2 -d -r2.37 -r2.37.8.1
*** newmodule.c	2001/11/13 20:11:55	2.37
--- newmodule.c	2002/01/28 15:03:36	2.37.8.1
***************
*** 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 ----