summaryrefslogtreecommitdiff
path: root/sphinx/util/inspect.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/inspect.py')
-rw-r--r--sphinx/util/inspect.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index 921dbc5e2..96f04a3d3 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -749,7 +749,7 @@ def getdoc(obj: Any, attrgetter: Callable = safe_getattr,
elif doc is None and allow_inherited:
doc = inspect.getdoc(obj)
- if doc is None and cls:
+ if doc is None and cls and name:
# inspect.getdoc() does not support some kind of inherited and decorated methods.
# This tries to obtain the docstring from super classes.
for basecls in getattr(cls, '__mro__', []):