Skip to content

Commit

Permalink
Fix #7137: viewcode: Avoid to crash when non-python code given
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Feb 17, 2020
1 parent 46f7dc5 commit 85138ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -22,6 +22,7 @@ Bugs fixed
* #7146: autodoc: IndexError is raised on suppressed type_comment found
* #7161: autodoc: typehints extension does not support parallel build
* #7151: crashed when extension assigns a value to ``env.indexentries``
* #7137: viewcode: Avoid to crash when non-python code given

Testing
--------
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/viewcode.py
Expand Up @@ -66,11 +66,11 @@ def has_tag(modname, fullname, docname, refname):
if code_tags is None:
try:
analyzer = ModuleAnalyzer.for_module(modname)
analyzer.find_tags()
except Exception:
env._viewcode_modules[modname] = False # type: ignore
return

analyzer.find_tags()
code = analyzer.code
tags = analyzer.tags
else:
Expand Down

0 comments on commit 85138ff

Please sign in to comment.