Skip to content

Commit 67fb3d1

Browse files
committed
Fix uncatched exception in get type hints
1 parent f590268 commit 67fb3d1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sphinx/util/typing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ def get_type_hints(obj: Any, globalns: Dict = None, localns: Dict = None) -> Dic
8686
except NameError:
8787
# Failed to evaluate ForwardRef (maybe TYPE_CHECKING)
8888
return safe_getattr(obj, '__annotations__', {})
89+
except AttributeError:
90+
# Failed to evaluate ForwardRef (maybe not runtime checkable)
91+
return safe_getattr(obj, '__annotations__', {})
8992
except TypeError:
9093
# Invalid object is given. But try to get __annotations__ as a fallback for
9194
# the code using type union operator (PEP 604) in python 3.9 or below.

0 commit comments

Comments
 (0)