diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-12-22 01:24:24 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 01:24:24 +0900 |
commit | 31cad2ebe7a205154e1374bfa52338111e515719 (patch) | |
tree | cf13e9efbcc932b401708aca352318d39408a305 | |
parent | 97a0babd468ed26fc5c29eab13b3d5f423408edf (diff) | |
parent | b3292b55b39ca075595cfe01a4fe4bcc7b7d9a57 (diff) | |
download | sphinx-git-31cad2ebe7a205154e1374bfa52338111e515719.tar.gz |
Merge pull request #8570 from tk0miya/8569_getslots_TypeError
Fixes #8568. Ignore TypeError from getslots in isslotsattribute
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | sphinx/ext/autodoc/__init__.py | 2 | ||||
-rw-r--r-- | sphinx/util/inspect.py | 1 |
3 files changed, 3 insertions, 1 deletions
@@ -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): |