[Python-checkins] CVS: python/dist/src/Include descrobject.h,2.4,2.5 object.h,2.91,2.92

Guido van Rossum gvanrossum@users.sourceforge.net
Thu, 20 Sep 2001 14:45:28 -0700


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

Modified Files:
	descrobject.h object.h 
Log Message:
Add optional docstrings to getset descriptors.  Fortunately, there's
no backwards compatibility to worry about, so I just pushed the
'closure' struct member to the back -- it's never used in the current
code base (I may eliminate it, but that's more work because the getter
and setter signatures would have to change.)

As examples, I added actual docstrings to the getset attributes of a
few types: file.closed, xxsubtype.spamdict.state.



Index: descrobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/descrobject.h,v
retrieving revision 2.4
retrieving revision 2.5
diff -C2 -d -r2.4 -r2.5
*** descrobject.h	2001/09/20 20:46:18	2.4
--- descrobject.h	2001/09/20 21:45:26	2.5
***************
*** 1,13 ****
! /* XXX getter, setter, getsetlist and wrapperbase need 'Py'-prefixed names */
  
  typedef PyObject *(*getter)(PyObject *, void *);
  typedef int (*setter)(PyObject *, PyObject *, void *);
  
! struct getsetlist {
  	char *name;
  	getter get;
  	setter set;
  	void *closure;
! };
  
  typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
--- 1,14 ----
! /* Descriptors */
  
  typedef PyObject *(*getter)(PyObject *, void *);
  typedef int (*setter)(PyObject *, PyObject *, void *);
  
! typedef struct PyGetSetDef {
  	char *name;
  	getter get;
  	setter set;
+ 	char *doc;
  	void *closure;
! } PyGetSetDef;
  
  typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
***************
*** 24,28 ****
  					       struct PyMemberDef *);
  extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
! 					       struct getsetlist *);
  extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
  						struct wrapperbase *, void *);
--- 25,29 ----
  					       struct PyMemberDef *);
  extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
! 					       struct PyGetSetDef *);
  extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
  						struct wrapperbase *, void *);

Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.91
retrieving revision 2.92
diff -C2 -d -r2.91 -r2.92
*** object.h	2001/09/20 20:46:18	2.91
--- object.h	2001/09/20 21:45:26	2.92
***************
*** 276,280 ****
  	struct PyMethodDef *tp_methods;
  	struct PyMemberDef *tp_members;
! 	struct getsetlist *tp_getset;
  	struct _typeobject *tp_base;
  	PyObject *tp_dict;
--- 276,280 ----
  	struct PyMethodDef *tp_methods;
  	struct PyMemberDef *tp_members;
! 	struct PyGetSetDef *tp_getset;
  	struct _typeobject *tp_base;
  	PyObject *tp_dict;