Skip to content

Commit

Permalink
Merge pull request #7174 from tk0miya/7137_viewcode_non_python_code
Browse files Browse the repository at this point in the history
Fix #7137: viewcode: Avoid to crash when non-python code given
  • Loading branch information
tk0miya committed Feb 17, 2020
2 parents 8ccae39 + 739cf21 commit 011bdeb
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 @@ -23,6 +23,7 @@ Bugs fixed
* #7161: autodoc: typehints extension does not support parallel build
* #7151: crashed when extension assigns a value to ``env.indexentries``
* #7170: text: Remove debug print
* #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 011bdeb

Please sign in to comment.