Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tk0miya opened this issue Aug 10, 2021 · 0 comments

Comments

@tk0miya
Copy link
Member

tk0miya commented Aug 10, 2021

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

@tk0miya tk0miya added this to the 4.1.3 milestone Aug 10, 2021
tk0miya added a commit that referenced this issue Aug 10, 2021
Fix #9537: autodoc: Some typing.* objects are broken
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant