Skip to content

Commit 5679620

Browse files
committed
Fix #7126: autodoc: TypeError: getset_descriptor object is not iterable
1 parent 0eb3d65 commit 5679620

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Bugs fixed
1717
----------
1818

1919
* #7120: html: crashed when on scaling SVG images which have float dimentions
20+
* #7126: autodoc: TypeError: 'getset_descriptor' object is not iterable
2021

2122
Testing
2223
--------

sphinx/ext/autodoc/importer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import traceback
1313
import warnings
1414
from collections import namedtuple
15-
from typing import Any, Callable, Dict, List, Tuple
15+
from typing import Any, Callable, Dict, List, Mapping, Tuple
1616

1717
from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
1818
from sphinx.util import logging
@@ -164,7 +164,7 @@ def get_object_members(subject: Any, objpath: List[str], attrgetter: Callable,
164164
continue
165165

166166
# annotation only member (ex. attr: int)
167-
if hasattr(subject, '__annotations__'):
167+
if hasattr(subject, '__annotations__') and isinstance(subject.__annotations__, Mapping):
168168
for name in subject.__annotations__:
169169
if name not in members:
170170
members[name] = Attribute(name, True, INSTANCEATTR)

0 commit comments

Comments
 (0)