Fix #7126: autodoc: TypeError: getset_descriptor object is not iterable

This commit is contained in:
Takeshi KOMIYA
2020-02-11 11:08:36 +09:00
parent 0eb3d65e47
commit 5679620253
2 changed files with 3 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ Bugs fixed
----------
* #7120: html: crashed when on scaling SVG images which have float dimentions
* #7126: autodoc: TypeError: 'getset_descriptor' object is not iterable
Testing
--------

View File

@@ -12,7 +12,7 @@ import importlib
import traceback
import warnings
from collections import namedtuple
from typing import Any, Callable, Dict, List, Tuple
from typing import Any, Callable, Dict, List, Mapping, Tuple
from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
from sphinx.util import logging
@@ -164,7 +164,7 @@ def get_object_members(subject: Any, objpath: List[str], attrgetter: Callable,
continue
# annotation only member (ex. attr: int)
if hasattr(subject, '__annotations__'):
if hasattr(subject, '__annotations__') and isinstance(subject.__annotations__, Mapping):
for name in subject.__annotations__:
if name not in members:
members[name] = Attribute(name, True, INSTANCEATTR)