From 5fe6a62aaafbd8f970dbcf95aa6344c4b784a68e Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Mon, 15 Feb 2021 00:16:58 -0500 Subject: [PATCH] Sometimes _viewcode_modules can be False; don't crash when it is - Fixes #8880 --- sphinx/ext/viewcode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index 21cff6a032a..6bedf2e1c5b 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -152,7 +152,11 @@ def env_merge_info(app: Sphinx, env: BuildEnvironment, docnames: Iterable[str], def env_purge_doc(app: Sphinx, env: BuildEnvironment, docname: str) -> None: modules = getattr(env, '_viewcode_modules', {}) - for modname, (code, tags, used, refname) in list(modules.items()): + for modname, entry in list(modules.items()): + if entry is False: + continue + + code, tags, used, refname = entry for fullname in list(used): if used[fullname] == docname: used.pop(fullname)