Skip to content

Commit

Permalink
Fix #9589: autodoc: typing.Annotated has wrongly been rendered
Browse files Browse the repository at this point in the history
At the HEAD of 3.10, the implementation of `typing.Annotated` has
been changed to have __qualname__.
  • Loading branch information
tk0miya committed Aug 29, 2021
1 parent 9f46b1f commit b82d3ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGES
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions sphinx/util/typing.py
Expand Up @@ -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__
Expand Down

0 comments on commit b82d3ef

Please sign in to comment.