diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py index b9c2ec6d252..fd5735c579d 100644 --- a/sphinx/util/typing.py +++ b/sphinx/util/typing.py @@ -86,6 +86,9 @@ def get_type_hints(obj: Any, globalns: Dict = None, localns: Dict = None) -> Dic except NameError: # Failed to evaluate ForwardRef (maybe TYPE_CHECKING) return safe_getattr(obj, '__annotations__', {}) + except AttributeError: + # Failed to evaluate ForwardRef (maybe not runtime checkable) + return safe_getattr(obj, '__annotations__', {}) except TypeError: # Invalid object is given. But try to get __annotations__ as a fallback for # the code using type union operator (PEP 604) in python 3.9 or below.