Skip to content

Commit 31e07c7

Browse files
authored
Add support for PEP 585 generics
1 parent 810a1e2 commit 31e07c7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sphinx/util/typing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ def stringify(annotation: Any) -> str:
310310
return INVALID_BUILTIN_CLASSES[annotation]
311311
elif (getattr(annotation, '__module__', None) == 'builtins' and
312312
hasattr(annotation, '__qualname__')):
313+
if hasattr(annotation, '__args__'): # PEP 585 generic
314+
return repr(annotation)
313315
return annotation.__qualname__
314316
elif annotation is Ellipsis:
315317
return '...'

0 commit comments

Comments
 (0)