From adc8c8019051e07b93ab25c8f73485f6e76f0d16 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 1 Mar 2018 02:18:35 +0900 Subject: [PATCH] Fix autodoc: crashed when invalid options given --- CHANGES | 1 + sphinx/ext/autodoc/directive.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index b8ab15e8c..94cda85c2 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ Bugs fixed * #4669: sphinx.build_main and sphinx.make_main throw NameError * #4685: autosummary emits meaningless warnings +* autodoc: crashed when invalid options given Testing -------- diff --git a/sphinx/ext/autodoc/directive.py b/sphinx/ext/autodoc/directive.py index f050b2ac4..0e19516ad 100644 --- a/sphinx/ext/autodoc/directive.py +++ b/sphinx/ext/autodoc/directive.py @@ -58,7 +58,7 @@ class DocumenterBridge(object): def warn(self, msg): # type: (unicode) -> None - logger.warning(msg, line=self.lineno) + logger.warning(msg, location=(self.env.docname, self.lineno)) def process_documenter_options(documenter, config, options): @@ -125,7 +125,7 @@ class AutodocDirective(Directive): except (KeyError, ValueError, TypeError) as exc: # an option is either unknown or has a wrong type logger.error('An option to %s is either unknown or has an invalid value: %s' % - (self.name, exc), line=lineno) + (self.name, exc), location=(source, lineno)) return [] # generate the output