diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-12-29 12:37:45 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-12-29 12:37:45 +0300 |
commit | a122397b4b5f5ab313f2e3fa28609aaf5cc79ab0 (patch) | |
tree | bb861d7b904d1cf678918b5c9d1ffcec2f4f86bc /sphinx/util | |
parent | bac090cf40db31ddb74abb573fd3260af3d93734 (diff) | |
parent | 3f7bf48715ed5d6b0cf5d2645ee2886975b97b10 (diff) |
Merge branch '3.x'
Diffstat (limited to 'sphinx/util')
-rw-r--r-- | sphinx/util/inspect.py | 1 | ||||
-rw-r--r-- | sphinx/util/typing.py | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index aa0d4aca6..8122654b3 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -187,6 +187,7 @@ def getslots(obj: Any) -> Optional[Dict]: Return None if gienv *obj* does not have __slots__. Raises AttributeError if given *obj* raises an error on accessing __slots__. + Raises TypeError if given *obj* is not a class. Raises ValueError if given *obj* have invalid __slots__. """ if not inspect.isclass(obj): diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py index 35f95140d..3c551a41f 100644 --- a/sphinx/util/typing.py +++ b/sphinx/util/typing.py @@ -150,6 +150,8 @@ def _restify_py37(cls: Optional["Type"]) -> str: return ':obj:`%s`' % cls._name else: return ':obj:`%s.%s`' % (cls.__module__, cls._name) + elif isinstance(cls, ForwardRef): + return ':class:`%s`' % cls.__forward_arg__ else: # not a class (ex. TypeVar) return ':obj:`%s.%s`' % (cls.__module__, cls.__name__) |