diff options
author | Georg Brandl <georg@python.org> | 2015-01-15 08:26:40 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2015-01-15 08:26:40 +0100 |
commit | ab546acef0f88fd4aa5132e8cbaa45a99e55624e (patch) | |
tree | 7361b3bbd1885c9850cbbe7170385f06dbf862d9 /sphinx/ext/autodoc.py | |
parent | dee3e60ee69517f737b70a9a096e8956ec447112 (diff) | |
download | sphinx-git-ab546acef0f88fd4aa5132e8cbaa45a99e55624e.tar.gz |
#1674: do not crash if module.__all__ is not according to spec
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r-- | sphinx/ext/autodoc.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 7c2f35f4e..ba4619e7c 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -879,6 +879,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 = [] |