[Python-checkins] CVS: python/dist/src/Include descrobject.h,1.1.2.4,1.1.2.5

Guido van Rossum gvanrossum@users.sourceforge.net
Sun, 29 Apr 2001 18:14:58 -0700


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

Modified Files:
      Tag: descr-branch
	descrobject.h 
Log Message:
Redoing the special-methods code so that the __foo__ wrapper for type
X actually contains a reference to the function in X's tp_foo slot,
rather than simply calling PyObject_Foo().  This will make overriding
__foo__ with a Python function easier, once I get to that.

This isn't completely done, but many things work,
e.g. type(1).__add__(3, 4).



Index: descrobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/Attic/descrobject.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -r1.1.2.4 -r1.1.2.5
*** descrobject.h	2001/04/29 14:53:55	1.1.2.4
--- descrobject.h	2001/04/30 01:14:56	1.1.2.5
***************
*** 11,14 ****
--- 11,22 ----
  };
  
+ typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, void *wrapped);
+ 
+ struct wrapperbase {
+ 	char *name;
+ 	wrapperfunc wrapper;
+ 	char *doc;
+ };
+ 
  extern PyTypeObject PyDescr_Type;
  
***************
*** 22,25 ****
--- 30,36 ----
  extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
  					       struct getsetlist *);
+ extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
+ 						struct wrapperbase *, void *);
  
  extern DL_IMPORT(PyObject *) PyDictProxy_New(PyObject *);
+ extern DL_IMPORT(PyObject *) PyWrapper_New(PyDescrObject *, PyObject *);