diff --git a/CHANGES b/CHANGES index d34034f8ca2..a42749000c9 100644 --- a/CHANGES +++ b/CHANGES @@ -43,6 +43,7 @@ Bugs fixed with Python 3.10 * #9968: autodoc: instance variables are not shown if __init__ method has position-only-arguments +* #9194: autodoc: Literal type in signature is not hyperlinked * #9947: i18n: topic directive having a bullet list can't be translatable * #9878: mathjax: MathJax configuration is placed after loading MathJax itself * #9857: Generated RFC links use outdated base url diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 67b52c187e2..f30342b0fa7 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -83,7 +83,7 @@ class ModuleEntry(NamedTuple): def type_to_xref(target: str, env: BuildEnvironment = None, suppress_prefix: bool = False ) -> addnodes.pending_xref: """Convert a type string to a cross reference node.""" - if target == 'None': + if target in ('None', 'typing.Literal'): reftype = 'obj' else: reftype = 'class'