diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-08-29 15:40:49 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-08-29 16:02:35 +0900 |
commit | a1bb4a81ced6f39504cd409e5d7305d35ed0ddb1 (patch) | |
tree | 53ddf3dd7ce9ebf27674b1a0a98864afc1c31088 | |
parent | 9f46b1fa6712ce748899a5ab5a20e532c8976352 (diff) | |
download | sphinx-git-4.1.x.tar.gz |
Fix #9589: autodoc: typing.Annotated has wrongly been rendered4.1.x
At the HEAD of 3.10, the implementation of `typing.Annotated` has
been changed to have __qualname__.
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | sphinx/util/typing.py | 2 |
2 files changed, 4 insertions, 2 deletions
@@ -18,8 +18,8 @@ Bugs fixed * #9504: autodoc: generate incorrect reference to the parent class if the target class inherites the class having ``_name`` attribute -* #9537: autodoc: Some objects under ``typing`` module are not displayed well - with the HEAD of 3.10 +* #9537, #9589: autodoc: Some objects under ``typing`` module are not displayed + well with the HEAD of 3.10 * #9512: sphinx-build: crashed with the HEAD of Python 3.10 Testing diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py index df5277ae7..35f808211 100644 --- a/sphinx/util/typing.py +++ b/sphinx/util/typing.py @@ -306,6 +306,8 @@ def stringify(annotation: Any) -> str: return 'None' elif annotation in INVALID_BUILTIN_CLASSES: return INVALID_BUILTIN_CLASSES[annotation] + elif str(annotation).startswith('typing.Annotated'): # for py310+ + pass elif (getattr(annotation, '__module__', None) == 'builtins' and getattr(annotation, '__qualname__', None)): return annotation.__qualname__ |