diff options
author | shimizukawa <shimizukawa@gmail.com> | 2016-12-05 23:14:25 +0900 |
---|---|---|
committer | shimizukawa <shimizukawa@gmail.com> | 2016-12-05 23:14:25 +0900 |
commit | 0a7d039df59d15e56b74d7c6bdb72d2454f31cc1 (patch) | |
tree | be59b0e16f7254482c563bbadfa121b751f55811 /sphinx/ext/autodoc.py | |
parent | a265670b79e737a0c88ea76dbac5485c19f6e350 (diff) | |
parent | 9f3a95e1da6c8a026df0b197e9d941f963341c38 (diff) | |
download | sphinx-git-0a7d039df59d15e56b74d7c6bdb72d2454f31cc1.tar.gz |
Merge branch '1.5-release' into master
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 9385c5c02..fbdd8d1ae 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -50,6 +50,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 @@ -1568,10 +1573,13 @@ class AttributeDocumenter(DocstringStripSignatureMixin, ClassLevelDocumenter): @classmethod def can_document_member(cls, member, membername, isattr, parent): # type: (Any, unicode, bool, Any) -> bool + 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)) |