[Python-checkins] CVS: python/dist/src/Objects classobject.c,2.143,2.144

Guido van Rossum gvanrossum@users.sourceforge.net
Wed, 05 Sep 2001 15:52:52 -0700


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

Modified Files:
	classobject.c 
Log Message:
Add PyMethod_Function(), PyMethod_Self(), PyMethod_Class() back.
While not even documented, they were clearly part of the C API,
there's no great difficulty to support them, and it has the cool
effect of not requiring any changes to ExtensionClass.c.


Index: classobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v
retrieving revision 2.143
retrieving revision 2.144
diff -C2 -d -r2.143 -r2.144
*** classobject.c	2001/08/29 23:51:41	2.143
--- classobject.c	2001/09/05 22:52:50	2.144
***************
*** 107,110 ****
--- 107,140 ----
  }
  
+ PyObject *
+ PyMethod_Function(PyObject *im)
+ {
+ 	if (!PyMethod_Check(im)) {
+ 		PyErr_BadInternalCall();
+ 		return NULL;
+ 	}
+ 	return ((PyMethodObject *)im)->im_func;
+ }
+ 
+ PyObject *
+ PyMethod_Self(PyObject *im)
+ {
+ 	if (!PyMethod_Check(im)) {
+ 		PyErr_BadInternalCall();
+ 		return NULL;
+ 	}
+ 	return ((PyMethodObject *)im)->im_self;
+ }
+ 
+ PyObject *
+ PyMethod_Class(PyObject *im)
+ {
+ 	if (!PyMethod_Check(im)) {
+ 		PyErr_BadInternalCall();
+ 		return NULL;
+ 	}
+ 	return ((PyMethodObject *)im)->im_class;
+ }
+ 
  static PyObject *
  class_new(PyTypeObject *type, PyObject *args, PyObject *kwds)