(Resenting as it was not on the list somehow) Hi,
the attached patch causes Sphinx to correctly treat method descriptors as methods instead of attributes. That's especially useful now that autodoc can scan method doc strings for signatures, as that's currently not working if you use :members:. Comments appreciated. -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/. -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
# HG changeset patch # User Julian Andres Klode <j...@debian.org> # Date 1304522339 -7200 # Node ID 9fed8fc999a596fe293aabc176f8b447792bd512 # Parent 4b8d012cf82e2c5ca916f5f23c40a38854a027e9 Correctly treat built-in method (method descriptors) as methods This fixes a bug where method descriptors were treated as data descriptors. As the builtin_method_descriptor type is not exported anywhere in Python, we check for the name here. As we know that it is a descriptor, this should not be a problem. diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -1160,7 +1160,8 @@ @classmethod def can_document_member(cls, member, membername, isattr, parent): isdatadesc = isdescriptor(member) and not \ - isinstance(member, cls.method_types) + isinstance(member, cls.method_types) and not \ + type(member).__name__ == "method_descriptor" return isdatadesc or (not isinstance(parent, ModuleDocumenter) and not inspect.isroutine(member) and not isinstance(member, class_types))