diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-10-16 09:57:54 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-10-16 09:57:54 +0900 |
commit | e7e07fd69723c02d6b011142f5e97fe2d42bd7d9 (patch) | |
tree | 1fe9194dd4115ed070212641ecc46e7d8846d13d /sphinx/util/inspect.py | |
parent | 25678f391d55a701b7d5f2d2e214db980dcebbd3 (diff) | |
parent | be2b86cc15a2f5fca1581c25ebf2db9a189dbc41 (diff) | |
download | sphinx-git-e7e07fd69723c02d6b011142f5e97fe2d42bd7d9.tar.gz |
Merge branch '1.8'
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', |