Skip to content

Commit a1bb4a8

Browse files
committed
Fix #9589: autodoc: typing.Annotated has wrongly been rendered
At the HEAD of 3.10, the implementation of `typing.Annotated` has been changed to have __qualname__.
1 parent 9f46b1f commit a1bb4a8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGES

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Bugs fixed
1818

1919
* #9504: autodoc: generate incorrect reference to the parent class if the target
2020
class inherites the class having ``_name`` attribute
21-
* #9537: autodoc: Some objects under ``typing`` module are not displayed well
22-
with the HEAD of 3.10
21+
* #9537, #9589: autodoc: Some objects under ``typing`` module are not displayed
22+
well with the HEAD of 3.10
2323
* #9512: sphinx-build: crashed with the HEAD of Python 3.10
2424

2525
Testing

sphinx/util/typing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ def stringify(annotation: Any) -> str:
306306
return 'None'
307307
elif annotation in INVALID_BUILTIN_CLASSES:
308308
return INVALID_BUILTIN_CLASSES[annotation]
309+
elif str(annotation).startswith('typing.Annotated'): # for py310+
310+
pass
309311
elif (getattr(annotation, '__module__', None) == 'builtins' and
310312
getattr(annotation, '__qualname__', None)):
311313
return annotation.__qualname__

0 commit comments

Comments
 (0)