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

Add support for PEP 585 generics #9464

Merged
merged 2 commits into from Jul 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions sphinx/util/typing.py
Expand Up @@ -310,6 +310,8 @@ def stringify(annotation: Any) -> str:
return INVALID_BUILTIN_CLASSES[annotation]
elif (getattr(annotation, '__module__', None) == 'builtins' and
hasattr(annotation, '__qualname__')):
if hasattr(annotation, '__args__'): # PEP 585 generic
return repr(annotation)
return annotation.__qualname__
Gobot1234 marked this conversation as resolved.
Show resolved Hide resolved
elif annotation is Ellipsis:
return '...'
Expand Down