Skip to content

Commit 31cad2e

Browse files
authored
Merge pull request #8570 from tk0miya/8569_getslots_TypeError
Fixes #8568. Ignore TypeError from getslots in isslotsattribute
2 parents 97a0bab + b3292b5 commit 31cad2e

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Bugs fixed
1818

1919
* #8559: autodoc: AttributeError is raised when using forward-reference type
2020
annotations
21+
* #8568: autodoc: TypeError is raised on checking slots attribute
2122

2223
Testing
2324
--------

sphinx/ext/autodoc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2114,7 +2114,7 @@ def isslotsattribute(self) -> bool:
21142114
return True
21152115
else:
21162116
return False
2117-
except (AttributeError, ValueError):
2117+
except (AttributeError, ValueError, TypeError):
21182118
return False
21192119

21202120
def import_object(self, raiseerror: bool = False) -> bool:

sphinx/util/inspect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def getslots(obj: Any) -> Optional[Dict]:
187187
188188
Return None if gienv *obj* does not have __slots__.
189189
Raises AttributeError if given *obj* raises an error on accessing __slots__.
190+
Raises TypeError if given *obj* is not a class.
190191
Raises ValueError if given *obj* have invalid __slots__.
191192
"""
192193
if not inspect.isclass(obj):

0 commit comments

Comments
 (0)