Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #8143: AttributeError if autodoc_default_options contains False #8144

Merged
merged 1 commit into from
Aug 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Bugs fixed
----------

* #8085: i18n: Add support for having single text domain
* #8143: autodoc: AttributeError is raised when False value is passed to
autodoc_default_options
* #8093: The highlight warning has wrong location in some builders (LaTeX,
singlehtml and so on)

Expand Down
7 changes: 5 additions & 2 deletions sphinx/ext/autodoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ 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(',') if x.strip()]
elif arg is False:
return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect EMPTY here. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think so. None means the option is not set. And it skips all private-members automatically (as auto* directive does by default). At present, all :members:, :inherited-members: and :private-members: don't become EMPTY. I guess it will break autodoc unexpectedly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation.

else:
return [x.strip() for x in arg.split(',') if x.strip()]


def members_set_option(arg: Any) -> Union[object, Set[str]]:
Expand Down Expand Up @@ -172,7 +175,7 @@ def merge_members_option(options: Dict) -> None:

members = options.setdefault('members', [])
for key in {'private-members', 'special-members'}:
if key in options and options[key] is not ALL:
if key in options and options[key] not in (ALL, None):
for member in options[key]:
if member not in members:
members.append(member)
Expand Down