From 08a9a58b8f3897afca8c5ad3c43e0d7726a3da55 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 20 Sep 2001 21:45:26 +0000 Subject: Add optional docstrings to getset descriptors. Fortunately, there's no backwards compatibility to worry about, so I just pushed the 'closure' struct member to the back -- it's never used in the current code base (I may eliminate it, but that's more work because the getter and setter signatures would have to change.) As examples, I added actual docstrings to the getset attributes of a few types: file.closed, xxsubtype.spamdict.state. --- Include/descrobject.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Include/descrobject.h') diff --git a/Include/descrobject.h b/Include/descrobject.h index 3d581818f5..1671cebe1b 100644 --- a/Include/descrobject.h +++ b/Include/descrobject.h @@ -1,14 +1,15 @@ -/* XXX getter, setter, getsetlist and wrapperbase need 'Py'-prefixed names */ +/* Descriptors */ typedef PyObject *(*getter)(PyObject *, void *); typedef int (*setter)(PyObject *, PyObject *, void *); -struct getsetlist { +typedef struct PyGetSetDef { char *name; getter get; setter set; + char *doc; void *closure; -}; +} PyGetSetDef; typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, void *wrapped); @@ -23,7 +24,7 @@ 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 *); + struct PyGetSetDef *); extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); extern DL_IMPORT(int) PyDescr_IsData(PyObject *); -- cgit v1.2.1