Georg Brandl  committed ad4f40f

If an autodoc object cannot be imported, always re-read the document and show the full traceback of the import error.

  • Participants
  • Parent commits f4e6037

Comments (0)

Files changed (3)

 Release 1.0.7 (in development)
+* If an autodoc object cannot be imported, always re-read the
+  document containing the directive on next build.
+* If an autodoc object cannot be imported, show the full traceback
+  of the import error.
 * Fix a bug where the removal of download files and images wasn't

File sphinx/

 # This is increased every time an environment attribute is added
 # or changed to properly invalidate pickle files.
 default_substitutions = set([
                                     # contains all built docnames
         self.dependencies = {}      # docname -> set of dependent file
                                     # names, relative to documentation root
+        self.reread_always = set()  # docnames to re-read unconditionally on
+                                    # next build
         # File metadata
         self.metadata = {}          # docname -> dict of metadata items
         """Remove all traces of a source file in the inventory."""
         if docname in self.all_docs:
             self.all_docs.pop(docname, None)
+            self.reread_always.discard(docname)
             self.metadata.pop(docname, None)
             self.dependencies.pop(docname, None)
             self.titles.pop(docname, None)
+                # check the "reread always" list
+                if docname in self.reread_always:
+                    changed.add(docname)
+                    continue
                 # check the mtime of the document
                 mtime = self.all_docs[docname]
                 newmtime = path.getmtime(self.doc2path(docname))
     def note_dependency(self, filename):
         self.dependencies.setdefault(self.docname, set()).add(filename)
+    def note_reread(self):
+        self.reread_always.add(self.docname)
     def note_versionchange(self, type, version, node, lineno):
         self.versionchanges.setdefault(version, []).append(
             (type, self.temp_data['docname'], lineno,

File sphinx/ext/

 import re
 import sys
 import inspect
+import traceback
 from types import FunctionType, BuiltinFunctionType, MethodType, ClassType
 from docutils import nodes
         # this used to only catch SyntaxError, ImportError and AttributeError,
         # but importing modules with side effects can raise all kinds of errors
         except Exception, err:
+            if and not
                 'autodoc can\'t import/find %s %r, it reported error: '
                 '"%s", please check your spelling and sys.path' %
                 (self.objtype, str(self.fullname), err))
+            self.env.note_reread()
             return False
     def get_real_modname(self):