mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #8622 from tk0miya/8616_AttributeError_for_non_class
Fix #8616: autodoc: AttributeError when non-class is passed to autoclass
This commit is contained in:
commit
5383846ced
2
CHANGES
2
CHANGES
@ -19,6 +19,8 @@ Bugs fixed
|
||||
* #8164: autodoc: Classes that inherit mocked class are not documented
|
||||
* #8602: autodoc: The ``autodoc-process-docstring`` event is emitted to the
|
||||
non-datadescriptors unexpectedly
|
||||
* #8616: autodoc: AttributeError is raised on non-class object is passed to
|
||||
autoclass directive
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -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:
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user