diff options
Diffstat (limited to 'sphinx/util/inspect.py')
-rw-r--r-- | sphinx/util/inspect.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 1133ba8fa..541d5f5c5 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -322,10 +322,14 @@ class Signature: raise try: - self.annotations = typing.get_type_hints(subject) # type: ignore + if ispartial(subject): + # get_type_hints() does not support partial objects + self.annotations = {} # type: Dict[str, Any] + else: + self.annotations = typing.get_type_hints(subject) # type: ignore except Exception as exc: if (3, 5, 0) <= sys.version_info < (3, 5, 3) and isinstance(exc, AttributeError): - # python 3.5.2 raises ValueError for partial objects. + # python 3.5.2 raises ValueError for classmethod-ized partial objects. self.annotations = {} else: logger.warning('Invalid type annotation found on %r. Ignored: %r', |