Commit 8a92c627 authored by Guido van Rossum's avatar Guido van Rossum

New feature: if the object's type has a non-NULL tp_doc field, that

is returned as the object's __doc__ attribute.

(If only the list of methods would be referenced from the type...)
parent 73d8bff4
......@@ -250,8 +250,15 @@ Py_FindMethodInChain(chain, self, name)
PyObject *self;
char *name;
{
if (strcmp(name, "__methods__") == 0)
return listmethodchain(chain);
if (name[0] == '_' && name[1] == '_') {
if (strcmp(name, "__methods__") == 0)
return listmethodchain(chain);
if (strcmp(name, "__doc__") == 0) {
char *doc = self->ob_type->tp_doc;
if (doc != NULL)
return PyString_FromString(doc);
}
}
while (chain != NULL) {
PyMethodDef *ml = chain->methods;
for (; ml->ml_name != NULL; ml++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment