diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-12-20 19:43:36 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-12-21 18:37:02 +0300 |
commit | 423e7ab2ca42123584504ef03e0a3c07b9369275 (patch) | |
tree | 55ec3db502056aca44c572a6c2d53ef98df536df /sphinx/util | |
parent | 323b1364107ee0b2d40476d6806143a43e233cef (diff) |
Fix #8559: AttributeError is raised when using ForwardRef
The restify() helper crashes when ForwardRef is passed.
Diffstat (limited to 'sphinx/util')
-rw-r--r-- | sphinx/util/typing.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py index 222e2edf2..2d4f67bba 100644 --- a/sphinx/util/typing.py +++ b/sphinx/util/typing.py @@ -153,6 +153,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__) |