Skip to content

Commit

Permalink
Add support for PEP 585 generics
Browse files Browse the repository at this point in the history
  • Loading branch information
Gobot1234 committed Jul 17, 2021
1 parent 810a1e2 commit 31e07c7
Showing 1 changed file with 2 additions and 0 deletions.
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__
elif annotation is Ellipsis:
return '...'
Expand Down

0 comments on commit 31e07c7

Please sign in to comment.