Skip to content

Type annotations using typing._GenericAlias are not displayed well with the HEAD of 3.10 #9537

Closed
@tk0miya

Description

@tk0miya

Describe the bug

Recently, the implementation of typing._GenericAlias was changed on the HEAD of 3.10 (refs: python/cpython#27614). After this change, autodoc can't process type aliases built by typing._GenericAlias well.

Note: this breaks our CI. So it should be fixed on 4.1.3.

How to Reproduce

Python 3.10.0rc1+ (heads/3.10:4e0147e, Aug 11 2021, 00:14:32) [Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sphinx.util.typing import stringify
>>> from typing import Optional
>>> assert stringify(Optional[int]) == "Optional[int]"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError
>>> stringify(Optional[int])
'Optional[int, None]'

Expected behavior

No response

Your project

N/A

Screenshots

No response

OS

Linux

Python version

HEAD of 3.10

Sphinx version

4.1.x

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions