summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-10 00:14:59 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-10 23:06:36 +0900
commit7b902e862312d54f8fae002e9c1f4caf3b63375c (patch)
treed3640609e7302a0194ce65656b97b09e37cd099d
parentebf25713805c125f9df595cf5200f144128c82b5 (diff)
downloadsphinx-git-7b902e862312d54f8fae002e9c1f4caf3b63375c.tar.gz
Fix #7451: autodoc: failed with non-string __doc__ member
-rw-r--r--CHANGES2
-rw-r--r--sphinx/ext/autodoc/__init__.py3
2 files changed, 5 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 835dca018..11573f95b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
index f69e2b5f1..cfca54225 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -557,6 +557,9 @@ class Documenter:
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