Merge pull request #8581 from tk0miya/8566_autodoc_process_docstring_for_alias_classes

Fix #8566: autodoc-process-docstring is emitted to the alias classes
This commit is contained in:
Takeshi KOMIYA 2020-12-24 23:35:01 +09:00 committed by GitHub
commit 043260481b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -20,6 +20,8 @@ Bugs fixed
annotations annotations
* #8568: autodoc: TypeError is raised on checking slots attribute * #8568: autodoc: TypeError is raised on checking slots attribute
* #8567: autodoc: Instance attributes are incorrectly added to Parent class * #8567: autodoc: Instance attributes are incorrectly added to Parent class
* #8566: autodoc: The ``autodoc-process-docstring`` event is emitted to the
alias classes unexpectedly
* #8565: linkcheck: Fix PriorityQueue crash when link tuples are not * #8565: linkcheck: Fix PriorityQueue crash when link tuples are not
comparable comparable

View File

@ -587,10 +587,12 @@ class Documenter:
def add_content(self, more_content: Optional[StringList], no_docstring: bool = False def add_content(self, more_content: Optional[StringList], no_docstring: bool = False
) -> None: ) -> None:
"""Add content from docstrings, attribute documentation and user.""" """Add content from docstrings, attribute documentation and user."""
if no_docstring: # Suspended temporarily (see https://github.com/sphinx-doc/sphinx/pull/8533)
warnings.warn("The 'no_docstring' argument to %s.add_content() is deprecated." #
% self.__class__.__name__, # if no_docstring:
RemovedInSphinx50Warning, stacklevel=2) # warnings.warn("The 'no_docstring' argument to %s.add_content() is deprecated."
# % self.__class__.__name__,
# RemovedInSphinx50Warning, stacklevel=2)
# set sourcename and add content from attribute documentation # set sourcename and add content from attribute documentation
sourcename = self.get_sourcename() sourcename = self.get_sourcename()
@ -1661,8 +1663,9 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
) -> None: ) -> None:
if self.doc_as_attr: if self.doc_as_attr:
more_content = StringList([_('alias of %s') % restify(self.object)], source='') more_content = StringList([_('alias of %s') % restify(self.object)], source='')
super().add_content(more_content, no_docstring=True)
super().add_content(more_content) else:
super().add_content(more_content)
def document_members(self, all_members: bool = False) -> None: def document_members(self, all_members: bool = False) -> None:
if self.doc_as_attr: if self.doc_as_attr: