diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2016-12-03 16:25:58 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2016-12-03 16:25:58 +0900 |
commit | 61a6ca5b374e1f983414e2ba82a4867fb745ff2e (patch) | |
tree | 7ae3e7e8dc1c468f65d9b51ecefd09eb492c9773 /sphinx/ext/autodoc.py | |
parent | a9cab4f234d2706b199a81b703b9e8e9dd908752 (diff) | |
parent | 9cea699149cd07f2c3752ecf7afa676136dfb4c7 (diff) | |
download | sphinx-git-61a6ca5b374e1f983414e2ba82a4867fb745ff2e.tar.gz |
Merge branch 'stable' into 1.5-release
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r-- | sphinx/ext/autodoc.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 59e585678..c17b754e7 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -42,6 +42,11 @@ try: except ImportError: typing = None +# This type isn't exposed directly in any modules, but can be found +# here in most Python versions +MethodDescriptorType = type(type.__subclasses__) + + #: extended signature RE: with explicit module name separated by :: py_ext_sig_re = re.compile( r'''^ ([\w.]+::)? # explicit module name @@ -1479,10 +1484,13 @@ class AttributeDocumenter(DocstringStripSignatureMixin, ClassLevelDocumenter): @classmethod def can_document_member(cls, member, membername, isattr, parent): + non_attr_types = cls.method_types + (type, MethodDescriptorType) isdatadesc = isdescriptor(member) and not \ - isinstance(member, cls.method_types) and not \ - type(member).__name__ in ("type", "method_descriptor", - "instancemethod") + isinstance(member, non_attr_types) and not \ + type(member).__name__ == "instancemethod" + # That last condition addresses an obscure case of C-defined + # methods using a deprecated type in Python 3, that is not otherwise + # exported anywhere by Python return isdatadesc or (not isinstance(parent, ModuleDocumenter) and not inspect.isroutine(member) and not isinstance(member, class_types)) |