Merge pull request #9111 from tk0miya/9110_restify_GenericAlias

Fix #9110: autodoc: metadata of GenericAlias is not rendered as a reference in py37+
This commit is contained in:
Takeshi KOMIYA
2021-04-20 01:44:21 +09:00
committed by GitHub
5 changed files with 7 additions and 6 deletions

View File

@@ -18,6 +18,8 @@ Features added
* #8818: autodoc: Super class having ``Any`` arguments causes nit-picky warning
* #9095: autodoc: TypeError is raised on processing broken metaclass
* #9110: autodoc: metadata of GenericAlias is not rendered as a reference in
py37+
* #9098: html: copy-range protection for doctests doesn't work in Safari
* #9103: LaTeX: imgconverter: conversion runs even if not needed
* #8127: py domain: Ellipsis in info-field-list causes nit-picky warning

View File

@@ -1767,8 +1767,7 @@ class GenericAliasMixin(DataDocumenterMixinBase):
def update_content(self, more_content: StringList) -> None:
if inspect.isgenericalias(self.object):
alias = stringify_typehint(self.object)
more_content.append(_('alias of %s') % alias, '')
more_content.append(_('alias of %s') % restify(self.object), '')
more_content.append('', '')
super().update_content(more_content)

View File

@@ -1915,7 +1915,7 @@ def test_autodoc_GenericAlias(app):
'',
' A list of int',
'',
' alias of List[int]',
' alias of :class:`~typing.List`\\ [:class:`int`]',
'',
'',
'.. py:data:: T',
@@ -1923,7 +1923,7 @@ def test_autodoc_GenericAlias(app):
'',
' A list of int',
'',
' alias of List[int]',
' alias of :class:`~typing.List`\\ [:class:`int`]',
'',
]

View File

@@ -156,7 +156,7 @@ def test_autoattribute_GenericAlias(app):
'',
' A list of int',
'',
' alias of List[int]',
' alias of :class:`~typing.List`\\ [:class:`int`]',
'',
]

View File

@@ -96,7 +96,7 @@ def test_autodata_GenericAlias(app):
'',
' A list of int',
'',
' alias of List[int]',
' alias of :class:`~typing.List`\\ [:class:`int`]',
'',
]