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.
diff --git a/Objects/classobject.c b/Objects/classobject.c
index f8ee6fd..df10aa2 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -2036,10 +2036,10 @@
return PyObject_GetAttrString(im->im_func, "__name__");
}
-static struct getsetlist instancemethod_getsetlist[] = {
- {"__dict__", (getter)im_get_dict},
- {"__doc__", (getter)im_get_doc},
- {"__name__", (getter)im_get_name},
+static PyGetSetDef instancemethod_getsetlist[] = {
+ {"__dict__", (getter)im_get_dict, NULL, "same as im_func.__dict__"},
+ {"__doc__", (getter)im_get_doc, NULL, "same as im_func.__doc__"},
+ {"__name__", (getter)im_get_name, NULL, "same as im_func.__name__"},
{NULL} /* Sentinel */
};