Commits

Anonymous committed ad5867d

Fixed a bug in autodoc that caused a lot of headaches to the testsuite.

  • Participants
  • Parent commits 0a49658

Comments (0)

Files changed (1)

File sphinx/ext/autodoc.py

                               sys.getfilesystemencoding(), 'replace')
             sourcename = u'%s:docstring of %s' % (srcname, fullname)
             attr_docs = analyzer.find_attr_docs()
-            key = ('.'.join(objpath[:-1]), objpath[-1])
-            if key in attr_docs:
-                no_docstring = True
-                docstrings = [attr_docs[key]]
-                for i, line in enumerate(self.process_doc(docstrings, what,
-                                                          fullname, todoc)):
-                    self.result.append(indent + line, sourcename, i)
+            if objpath:
+                key = ('.'.join(objpath[:-1]), objpath[-1])
+                if key in attr_docs:
+                    no_docstring = True
+                    docstrings = [attr_docs[key]]
+                    for i, line in enumerate(self.process_doc(docstrings, what,
+                                                              fullname, todoc)):
+                        self.result.append(indent + line, sourcename, i)
         else:
             sourcename = u'docstring of %s' % fullname
             attr_docs = {}