[Python-checkins] CVS: python/dist/src/Modules xxsubtype.c,2.5,2.6

Guido van Rossum gvanrossum@users.sourceforge.net
2001年9月20日 13:46:20 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv25248/Modules
Modified Files:
	xxsubtype.c 
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: xxsubtype.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/xxsubtype.c,v
retrieving revision 2.5
retrieving revision 2.6
diff -C2 -d -r2.5 -r2.6
*** xxsubtype.c	2001年08月16日 09:10:42	2.5
--- xxsubtype.c	2001年09月20日 20:46:18	2.6
***************
*** 149,154 ****
 }
 
! static struct memberlist spamdict_members[] = {
! 	{"state", T_INT, offsetof(spamdictobject, state), READONLY},
 	{0}
 };
--- 149,155 ----
 }
 
! static PyMemberDef spamdict_members[] = {
! 	{"state", T_INT, offsetof(spamdictobject, state), READONLY,
! 	 "an int variable for demonstration purposes"},
 	{0}
 };

AltStyle によって変換されたページ (->オリジナル) /