mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#1674: do not crash if module.__all__ is not according to spec
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -26,6 +26,7 @@ Bugs fixed
|
||||
* #1585: Autosummary of modules broken in Sphinx-1.2.3.
|
||||
* #1610: Sphinx cause AttributeError when MeCab search option is enabled and
|
||||
python-mecab is not installed.
|
||||
* #1674: Do not crash if a module's ``__all__`` is not a list of strings.
|
||||
|
||||
|
||||
Release 1.2.3 (released Sep 1, 2014)
|
||||
|
@@ -828,6 +828,15 @@ class ModuleDocumenter(Documenter):
|
||||
return True, safe_getmembers(self.object)
|
||||
else:
|
||||
memberlist = self.object.__all__
|
||||
# Sometimes __all__ is broken...
|
||||
if not isinstance(memberlist, (list, tuple)) or not \
|
||||
all(isinstance(entry, str) for entry in memberlist):
|
||||
self.directive.warn(
|
||||
'__all__ should be a list of strings, not %r '
|
||||
'(in module %s) -- ignoring __all__' %
|
||||
(memberlist, self.fullname))
|
||||
# fall back to all members
|
||||
return True, safe_getmembers(self.object)
|
||||
else:
|
||||
memberlist = self.options.members or []
|
||||
ret = []
|
||||
|
Reference in New Issue
Block a user