summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/ext/autodoc/__init__.py')
-rw-r--r--sphinx/ext/autodoc/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
index a1c642703..7578ebab4 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -1662,7 +1662,11 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
def add_content(self, more_content: Optional[StringList], no_docstring: bool = False
) -> None:
if self.doc_as_attr:
- more_content = StringList([_('alias of %s') % restify(self.object)], source='')
+ try:
+ more_content = StringList([_('alias of %s') % restify(self.object)], source='')
+ except AttributeError:
+ pass # Invalid class object is passed.
+
super().add_content(more_content, no_docstring=True)
else:
super().add_content(more_content)