summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-09-20 21:45:26 (GMT)
committerGuido van Rossum <guido@python.org>2001-09-20 21:45:26 (GMT)
commit32d34c809f5971f79462dcb7d0f536d46e624acc (patch)
tree29d97883adf68d8112d55c94eca8f4fb93048628 /Include
parenta56b42b1ba646170d5476e8925c56e2266b37f98 (diff)
downloadcpython-32d34c809f5971f79462dcb7d0f536d46e624acc.zip
cpython-32d34c809f5971f79462dcb7d0f536d46e624acc.tar.gz
cpython-32d34c809f5971f79462dcb7d0f536d46e624acc.tar.bz2
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.
Diffstat (limited to 'Include')
-rw-r--r--Include/descrobject.h9
-rw-r--r--Include/object.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/Include/descrobject.h b/Include/descrobject.h
index 3d58181..1671ceb 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 *);
diff --git a/Include/object.h b/Include/object.h
index 1d0ae5f..4529b61 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -275,7 +275,7 @@ typedef struct _typeobject {
/* Attribute descriptor and subclassing stuff */
struct PyMethodDef *tp_methods;
struct PyMemberDef *tp_members;
- struct getsetlist *tp_getset;
+ struct PyGetSetDef *tp_getset;
struct _typeobject *tp_base;
PyObject *tp_dict;
descrgetfunc tp_descr_get;