mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #7137: viewcode: Avoid to crash when non-python code given
This commit is contained in:
parent
46f7dc53ef
commit
85138ff449
1
CHANGES
1
CHANGES
@ -22,6 +22,7 @@ Bugs fixed
|
|||||||
* #7146: autodoc: IndexError is raised on suppressed type_comment found
|
* #7146: autodoc: IndexError is raised on suppressed type_comment found
|
||||||
* #7161: autodoc: typehints extension does not support parallel build
|
* #7161: autodoc: typehints extension does not support parallel build
|
||||||
* #7151: crashed when extension assigns a value to ``env.indexentries``
|
* #7151: crashed when extension assigns a value to ``env.indexentries``
|
||||||
|
* #7137: viewcode: Avoid to crash when non-python code given
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -66,11 +66,11 @@ def doctree_read(app: Sphinx, doctree: Node) -> None:
|
|||||||
if code_tags is None:
|
if code_tags is None:
|
||||||
try:
|
try:
|
||||||
analyzer = ModuleAnalyzer.for_module(modname)
|
analyzer = ModuleAnalyzer.for_module(modname)
|
||||||
|
analyzer.find_tags()
|
||||||
except Exception:
|
except Exception:
|
||||||
env._viewcode_modules[modname] = False # type: ignore
|
env._viewcode_modules[modname] = False # type: ignore
|
||||||
return
|
return
|
||||||
|
|
||||||
analyzer.find_tags()
|
|
||||||
code = analyzer.code
|
code = analyzer.code
|
||||||
tags = analyzer.tags
|
tags = analyzer.tags
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user