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 /Include/structmember.h | |
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 'Include/structmember.h')
-rw-r--r-- | Include/structmember.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Include/structmember.h b/Include/structmember.h index cd35fdb..2c9f41d 100644 --- a/Include/structmember.h +++ b/Include/structmember.h @@ -28,12 +28,22 @@ extern "C" { pointer is NULL. */ struct memberlist { + /* Obsolete version, for binary backwards compatibility */ char *name; int type; int offset; int flags; }; +typedef struct PyMemberDef { + /* Current version, use this */ + char *name; + int type; + int offset; + int flags; + char *doc; +} PyMemberDef; + /* Types */ #define T_SHORT 0 #define T_INT 1 @@ -66,9 +76,15 @@ struct memberlist { #define RESTRICTED (READ_RESTRICTED | WRITE_RESTRICTED) +/* 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 } #endif |