summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r--sphinx/ext/autodoc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index 72d500297..ce5eac780 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -841,7 +841,10 @@ class ClassDocumenter(ModuleLevelDocumenter):
# if the class is documented under another name, document it
# as data/attribute
if ret:
- self.doc_as_attr = (self.objpath[-1] != self.object.__name__)
+ if hasattr(self.object, '__name__'):
+ self.doc_as_attr = (self.objpath[-1] != self.object.__name__)
+ else:
+ self.doc_as_attr = True
return ret
def format_args(self):