Merge pull request #8570 from tk0miya/8569_getslots_TypeError

Fixes #8568. Ignore TypeError from getslots in isslotsattribute
This commit is contained in:
Takeshi KOMIYA
2020-12-22 01:24:24 +09:00
committed by GitHub
3 changed files with 3 additions and 1 deletions

View File

@@ -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
--------

View File

@@ -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:

View File

@@ -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):