From 4431f11876e05ff2e8f85c087b3df749d3b28a6f Mon Sep 17 00:00:00 2001 From: Rafal Wojdyla Date: Mon, 21 Dec 2020 14:23:31 +0100 Subject: [PATCH 1/3] Fixes #8568. Ignore TypeError from getslots in isslotsattribute --- sphinx/ext/autodoc/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index a23547a6169..4bf97cc851a 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -2114,7 +2114,7 @@ def isslotsattribute(self) -> bool: return True else: return False - except (AttributeError, ValueError): + except (AttributeError, ValueError, TypeError): return False def import_object(self, raiseerror: bool = False) -> bool: From 22080940e252fe47cb1dccf3fd9029b7c9d21de5 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 22 Dec 2020 00:53:27 +0900 Subject: [PATCH 2/3] doc: Update docstring of getslots() --- sphinx/util/inspect.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index a26c818c097..767ef319cae 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): From b3292b55b39ca075595cfe01a4fe4bcc7b7d9a57 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 22 Dec 2020 01:14:04 +0900 Subject: [PATCH 3/3] Update CHANGES for PR #8569 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index bcf7cf23486..6125b83a1da 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 --------