Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #7451: autodoc: failed with non-string __doc__ member #7452

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -26,6 +26,8 @@ Bugs fixed
* #7422: autodoc: fails with ValueError when using autodoc_mock_imports
* #7435: autodoc: ``autodoc_typehints='description'`` doesn't suppress typehints
in signature for classes/methods
* #7451: autodoc: fails with AttributeError when an object returns non-string
object as a ``__doc__`` member
* #7423: crashed when giving a non-string object to logger
* #7479: html theme: Do not include xmlns attribute with HTML 5 doctype
* #7426: html theme: Escape some links in HTML templates
Expand Down
3 changes: 3 additions & 0 deletions sphinx/ext/autodoc/__init__.py
Expand Up @@ -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
Expand Down