diff --git a/CHANGES b/CHANGES index b12cfd398c6..5c35cff7b77 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,8 @@ Bugs fixed * #7418: std domain: duplication warning for glossary terms is case insensitive * #7438: C++, fix merging overloaded functions in parallel builds. * #7422: autodoc: fails with ValueError when using autodoc_mock_imports +* #7451: autodoc: fails with AttributeError when an object returns non-string + object as a ``__doc__`` member Testing -------- diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index ad3e5f00add..f3835f4db54 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -557,6 +557,9 @@ def is_filtered_inherited_member(name: str) -> bool: isattr = False doc = getdoc(member, self.get_attr, self.env.config.autodoc_inherit_docstrings) + if not isinstance(doc, str): + # Ignore non-string __doc__ + doc = None # if the member __doc__ is the same as self's __doc__, it's just # inherited and therefore not the member's doc