Skip to content

Commit

Permalink
Fix autodoc: Show detailed warning when type_comment is mismatched (r…
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Jun 13, 2020
1 parent 46f79c5 commit b3affa6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Expand Up @@ -13,6 +13,9 @@ Deprecated
Features added
--------------

* #7807: autodoc: Show detailed warning when type_comment is mismatched with its
signature

Bugs fixed
----------

Expand Down
3 changes: 3 additions & 0 deletions sphinx/ext/autodoc/type_comment.py
Expand Up @@ -128,6 +128,9 @@ def update_annotations_using_type_comments(app: Sphinx, obj: Any, bound_method:

if 'return' not in obj.__annotations__:
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()
logger.warning(__("Failed to parse type_comment for %r: %s"), obj, exc)

Expand Down

0 comments on commit b3affa6

Please sign in to comment.