diff --git a/CHANGES b/CHANGES index 710ca51da..4d99e2c59 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,8 @@ Features added Bugs fixed ---------- +* #7370: autosummary: raises UnboundLocalError when unknown module given + Testing -------- diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index 5a87e4abf..932856aa6 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -279,7 +279,7 @@ def generate_autosummary_docs(sources: List[str], output_dir: str = None, try: name, obj, parent, mod_name = import_by_name(entry.name) except ImportError as e: - _warn(__('[autosummary] failed to import %r: %s') % (name, e)) + _warn(__('[autosummary] failed to import %r: %s') % (entry.name, e)) continue content = generate_autosummary_content(name, obj, parent, template, entry.template,