[Python-checkins] CVS: python/dist/src/Include descrobject.h,2.3,2.4 object.h,2.90,2.91 structmember.h,2.17,2.18
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 20 Sep 2001 13:46:20 -0700
Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv25248/Include
Modified Files:
descrobject.h object.h structmember.h
Log Message:
Add optional docstrings to member descriptors. For backwards
compatibility, this required all places where an array of "struct
memberlist" structures was declared that is referenced from a type's
tp_members slot to change the type of the structure to PyMemberDef;
"struct memberlist" is now only used by old code that still calls
PyMember_Get/Set. The code in PyObject_GenericGetAttr/SetAttr now
calls the new APIs PyMember_GetOne/SetOne, which take a PyMemberDef
argument.
As examples, I added actual docstrings to the attributes of a few
types: file, complex, instance method, super, and xxsubtype.spamlist.
Also converted the symtable to new style getattr.
Index: descrobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/descrobject.h,v
retrieving revision 2.3
retrieving revision 2.4
diff -C2 -d -r2.3 -r2.4
*** descrobject.h 2001/09/06 21:54:11 2.3
--- descrobject.h 2001/09/20 20:46:18 2.4
***************
*** 22,26 ****
extern DL_IMPORT(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
extern DL_IMPORT(PyObject *) PyDescr_NewMember(PyTypeObject *,
! struct memberlist *);
extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
struct getsetlist *);
--- 22,26 ----
extern DL_IMPORT(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
extern DL_IMPORT(PyObject *) PyDescr_NewMember(PyTypeObject *,
! struct PyMemberDef *);
extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
struct getsetlist *);
Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.90
retrieving revision 2.91
diff -C2 -d -r2.90 -r2.91
*** object.h 2001/09/18 20:38:53 2.90
--- object.h 2001/09/20 20:46:18 2.91
***************
*** 275,279 ****
/* Attribute descriptor and subclassing stuff */
struct PyMethodDef *tp_methods;
! struct memberlist *tp_members;
struct getsetlist *tp_getset;
struct _typeobject *tp_base;
--- 275,279 ----
/* Attribute descriptor and subclassing stuff */
struct PyMethodDef *tp_methods;
! struct PyMemberDef *tp_members;
struct getsetlist *tp_getset;
struct _typeobject *tp_base;
Index: structmember.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/structmember.h,v
retrieving revision 2.17
retrieving revision 2.18
diff -C2 -d -r2.17 -r2.18
*** structmember.h 2001/09/17 19:28:07 2.17
--- structmember.h 2001/09/20 20:46:18 2.18
***************
*** 29,32 ****
--- 29,33 ----
struct memberlist {
+ /* Obsolete version, for binary backwards compatibility */
char *name;
int type;
***************
*** 35,38 ****
--- 36,48 ----
};
+ typedef struct PyMemberDef {
+ /* Current version, use this */
+ char *name;
+ int type;
+ int offset;
+ int flags;
+ char *doc;
+ } PyMemberDef;
+
/* Types */
#define T_SHORT 0
***************
*** 67,72 ****
--- 77,88 ----
+ /* Obsolete API, for binary backwards compatibility */
DL_IMPORT(PyObject *) PyMember_Get(char *, struct memberlist *, char *);
DL_IMPORT(int) PyMember_Set(char *, struct memberlist *, char *, PyObject *);
+
+ /* Current API, use this */
+ DL_IMPORT(PyObject *) PyMember_GetOne(char *, struct PyMemberDef *);
+ DL_IMPORT(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *);
+
#ifdef __cplusplus