summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-12-22 01:24:24 +0900
committerGitHub <noreply@github.com>2020-12-22 01:24:24 +0900
commit31cad2ebe7a205154e1374bfa52338111e515719 (patch)
treecf13e9efbcc932b401708aca352318d39408a305
parent97a0babd468ed26fc5c29eab13b3d5f423408edf (diff)
parentb3292b55b39ca075595cfe01a4fe4bcc7b7d9a57 (diff)
downloadsphinx-git-31cad2ebe7a205154e1374bfa52338111e515719.tar.gz
Merge pull request #8570 from tk0miya/8569_getslots_TypeError
Fixes #8568. Ignore TypeError from getslots in isslotsattribute
-rw-r--r--CHANGES1
-rw-r--r--sphinx/ext/autodoc/__init__.py2
-rw-r--r--sphinx/util/inspect.py1
3 files changed, 3 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index bcf7cf234..6125b83a1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -18,6 +18,7 @@ Bugs fixed
* #8559: autodoc: AttributeError is raised when using forward-reference type
annotations
+* #8568: autodoc: TypeError is raised on checking slots attribute
Testing
--------
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
index a23547a61..4bf97cc85 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -2114,7 +2114,7 @@ class SlotsMixin(DataDocumenterMixinBase):
return True
else:
return False
- except (AttributeError, ValueError):
+ except (AttributeError, ValueError, TypeError):
return False
def import_object(self, raiseerror: bool = False) -> bool:
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index a26c818c0..767ef319c 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -187,6 +187,7 @@ def getslots(obj: Any) -> Optional[Dict]:
Return None if gienv *obj* does not have __slots__.
Raises AttributeError if given *obj* raises an error on accessing __slots__.
+ Raises TypeError if given *obj* is not a class.
Raises ValueError if given *obj* have invalid __slots__.
"""
if not inspect.isclass(obj):