diff options
author | Guido van Rossum <guido@python.org> | 2001-09-20 20:46:19 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-09-20 20:46:19 (GMT) |
commit | 6f7993765ac0989b5d13084240797913627a31d8 (patch) | |
tree | 51dd234049db1eb78c6dd25d23ec687bf91d817c /Modules | |
parent | e0af35eb694179d8da5d3208ffdfb92e5356335f (diff) | |
download | cpython-6f7993765ac0989b5d13084240797913627a31d8.zip cpython-6f7993765ac0989b5d13084240797913627a31d8.tar.gz cpython-6f7993765ac0989b5d13084240797913627a31d8.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/xxsubtype.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c index c20a1c7..cdf6d07 100644 --- a/Modules/xxsubtype.c +++ b/Modules/xxsubtype.c @@ -148,8 +148,9 @@ spamdict_init(spamdictobject *self, PyObject *args, PyObject *kwds) return 0; } -static struct memberlist spamdict_members[] = { - {"state", T_INT, offsetof(spamdictobject, state), READONLY}, +static PyMemberDef spamdict_members[] = { + {"state", T_INT, offsetof(spamdictobject, state), READONLY, + "an int variable for demonstration purposes"}, {0} }; |