Skip to content

Commit

Permalink
autodoc: check whether __slots__ is a str
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Oct 24, 2020
1 parent 3b85187 commit da4f091
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sphinx/ext/autodoc/importer.py
Expand Up @@ -206,7 +206,10 @@ def get_object_members(subject: Any, objpath: List[str], attrgetter: Callable,
if isclass(subject) and getattr(subject, '__slots__', None) is not None:
from sphinx.ext.autodoc import SLOTSATTR

for name in subject.__slots__:
slots = subject.__slots__
if isinstance(slots, str):
slots = [slots]
for name in slots:
members[name] = Attribute(name, True, SLOTSATTR)

# other members
Expand Down

0 comments on commit da4f091

Please sign in to comment.