Merge pull request #7130 from tk0miya/7126_autodoc_TypeError

Fix #7126: autodoc: TypeError: getset_descriptor object is not iterable
This commit is contained in:
Takeshi KOMIYA 2020-02-11 19:58:31 +09:00 committed by GitHub
commit 34da0e4539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 * #7120: html: crashed when on scaling SVG images which have float dimentions
* #7126: autodoc: TypeError: 'getset_descriptor' object is not iterable
Testing Testing
-------- --------

View File

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