Skip to content

Commit

Permalink
Merge pull request #8570 from tk0miya/8569_getslots_TypeError
Browse files Browse the repository at this point in the history
Fixes #8568. Ignore TypeError from getslots in isslotsattribute
  • Loading branch information
tk0miya committed Dec 21, 2020
2 parents 97a0bab + b3292b5 commit 31cad2e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -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
--------
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/autodoc/__init__.py
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions sphinx/util/inspect.py
Expand Up @@ -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):
Expand Down

0 comments on commit 31cad2e

Please sign in to comment.