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

Guido van Rossum gvanrossum@users.sourceforge.net
2001年8月15日 11:09:13 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv5529
Modified Files:
	xxsubtype.c 
Log Message:
Add 'state' as a read-only attribute to spamdict. This serves as an
example.
Index: xxsubtype.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/xxsubtype.c,v
retrieving revision 2.2
retrieving revision 2.3
diff -C2 -d -r2.2 -r2.3
*** xxsubtype.c	2001年08月07日 17:24:28	2.2
--- xxsubtype.c	2001年08月15日 18:09:11	2.3
***************
*** 1,3 ****
--- 1,4 ----
 #include "Python.h"
+ #include "structmember.h"
 
 /* Examples showing how to subtype the builtin list and dict types from C. */
***************
*** 137,140 ****
--- 138,146 ----
 }
 
+ static struct memberlist spamdict_members[] = {
+ 	{"state", T_INT, offsetof(spamdictobject, state), READONLY},
+ 	{0}
+ };
+ 
 static PyTypeObject spamdict_type = {
 	PyObject_HEAD_INIT(&PyType_Type)
***************
*** 167,171 ****
 	0,					/* tp_iternext */
 	spamdict_methods,			/* tp_methods */
! 	0,					/* tp_members */
 	0,					/* tp_getset */
 	&PyDict_Type,				/* tp_base */
--- 173,177 ----
 	0,					/* tp_iternext */
 	spamdict_methods,			/* tp_methods */
! 	spamdict_members,			/* tp_members */
 	0,					/* tp_getset */
 	&PyDict_Type,				/* tp_base */

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