-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
-
Create a descriptor type in a module
-
create a document with
.. automodule:: <module> :members: :show-inheritance:
Expected: documents the class as a class, documents its members and shows its inheritance
Observed: documents the class as an attribute, just shows its docstring
Problem source
AttributeDocumenter has a higher priority than ClassDocumenter and if the member being checked (in can_document_member) is a descriptor all other checks are ignored
Partial solution
put the isdatatesc check under not isinstance(parent, ModuleDocumenter) somehow: descriptors don't work at the module-level (save through shenanigans of explicitly creating a ModuleType subclass and shoving it into sys.modules by hand)
Issue remaining
defining a descriptor type as an inner class will still be incorrectly documented as an attribute
Alternative solution
Add not isinstance(member, class_types) in the decision tree for isdatadesc
- Bitbucket: https://bitbucket.org/birkenfeld/sphinx/issue/1526
- Originally reported by: masklinn
- Originally created at: 2014-08-04T10:39:39.357