From e7cba3516e6e3cd1cf90c29068c63c011e860204 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 9 Apr 2022 20:38:47 +0100 Subject: [PATCH] Fix test_restify --- sphinx/util/typing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py index 1534b2c8ee5..8e48b184bcc 100644 --- a/sphinx/util/typing.py +++ b/sphinx/util/typing.py @@ -215,6 +215,9 @@ def _restify_py37(cls: Optional[Type], mode: str = 'fully-qualified-except-typin return text elif isinstance(cls, typing._SpecialForm): return ':py:obj:`~%s.%s`' % (cls.__module__, cls._name) + elif sys.version_info >= (3, 11) and cls is typing.Any: + # handle bpo-46998 + return f':py:obj:`~{cls.__module__}.{cls.__name__}`' elif hasattr(cls, '__qualname__'): if cls.__module__ == 'typing': return ':py:class:`~%s.%s`' % (cls.__module__, cls.__qualname__)