Skip to content

Conversation

@vpratz
Copy link
Contributor

@vpratz vpratz commented Dec 20, 2024

Subject: Fix #12463: empty __all__ is ignored in autosummary

Feature or Bugfix

  • Bugfix

Purpose

The check for the absence of __all__ used the all or dir(obj) syntax. Unfortunately, this resolves to the second value not only for None, but also for an empty list. This lead to the unintended behavior that setting __all__ = [] was ignored by autosummary. Checking explicitly for None fixes this.

Detail

Please refer to #12463 for details on the issue and a reproducible example. The test in this PR also reproduces the behavior. It fails for the current master, but passes with the supplied change.

Relates

vpratz and others added 3 commits December 20, 2024 09:47
The check for the absence of `__all__` used the `all or dir(obj)`
syntax. Unfortunately, this resolves to the second value
not only for `None`, but also for an empty list. This lead to
the unintended behavior that setting `__all__ = []` was ignored
by autosummary. Checking explicitly for None fixes this.
@AA-Turner AA-Turner added this to the 8.2.0 milestone Jan 16, 2025
@AA-Turner AA-Turner changed the title Fix for #12463: empty __all__ is ignored in autosummary autosummary: Respect empty module __all__ Jan 16, 2025
@AA-Turner AA-Turner merged commit cfb4786 into sphinx-doc:master Jan 16, 2025
22 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autosummary ignores __all__ when it is empty

2 participants