mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix autodoc: Show detailed warning when type_comment is mismatched (refs: #7807)
This commit is contained in:
parent
46f79c55e1
commit
b3affa6949
3
CHANGES
3
CHANGES
@ -13,6 +13,9 @@ Deprecated
|
|||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
* #7807: autodoc: Show detailed warning when type_comment is mismatched with its
|
||||||
|
signature
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -128,6 +128,9 @@ def update_annotations_using_type_comments(app: Sphinx, obj: Any, bound_method:
|
|||||||
|
|
||||||
if 'return' not in obj.__annotations__:
|
if 'return' not in obj.__annotations__:
|
||||||
obj.__annotations__['return'] = type_sig.return_annotation
|
obj.__annotations__['return'] = type_sig.return_annotation
|
||||||
|
except KeyError as exc:
|
||||||
|
logger.warning(__("Failed to update signature for %r: parameter not found: %s"),
|
||||||
|
obj, exc)
|
||||||
except NotImplementedError as exc: # failed to ast.unparse()
|
except NotImplementedError as exc: # failed to ast.unparse()
|
||||||
logger.warning(__("Failed to parse type_comment for %r: %s"), obj, exc)
|
logger.warning(__("Failed to parse type_comment for %r: %s"), obj, exc)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user