From 56796202531a6d7e7402d2210d2b297e4cec87d3 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 11 Feb 2020 11:08:36 +0900 Subject: [PATCH] Fix #7126: autodoc: TypeError: getset_descriptor object is not iterable --- CHANGES | 1 + sphinx/ext/autodoc/importer.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index c0e68887a..b000154f8 100644 --- a/CHANGES +++ b/CHANGES @@ -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 -------- diff --git a/sphinx/ext/autodoc/importer.py b/sphinx/ext/autodoc/importer.py index 672d90ec7..c0381d7b4 100644 --- a/sphinx/ext/autodoc/importer.py +++ b/sphinx/ext/autodoc/importer.py @@ -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)