From e4bc1a48ac2a3aaf3ea147f0a231a3d0b60886ea Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 31 Jan 2020 00:42:26 +0900 Subject: [PATCH] Fix #6889: autodoc: Trailing comma in :members:: option causes cryptic warning --- CHANGES | 1 + sphinx/ext/autodoc/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index a5dc6da15..4c33180a3 100644 --- a/CHANGES +++ b/CHANGES @@ -63,6 +63,7 @@ Bugs fixed * #7023: autodoc: nested partial functions are not listed * #7023: autodoc: partial functions imported from other modules are listed as module members without :impoprted-members: option +* #6889: autodoc: Trailing comma in ``:members::`` option causes cryptic warning Testing -------- diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index c9eb5207f..e42169684 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -72,14 +72,14 @@ def members_option(arg: Any) -> Union[object, List[str]]: """Used to convert the :members: option to auto directives.""" if arg is None or arg is True: return ALL - return [x.strip() for x in arg.split(',')] + return [x.strip() for x in arg.split(',') if x.strip()] def members_set_option(arg: Any) -> Union[object, Set[str]]: """Used to convert the :members: option to auto directives.""" if arg is None: return ALL - return {x.strip() for x in arg.split(',')} + return {x.strip() for x in arg.split(',') if x.strip()} SUPPRESS = object()