From 191440725f01b02e6dbbd43198b9a5d022a116a6 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 6 Feb 2009 22:25:39 +0100 Subject: [PATCH] Fixed a bug in autodoc that caused a lot of headaches to the testsuite. --- sphinx/ext/autodoc.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 2727fd6cf..aecf343cc 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -473,13 +473,14 @@ class RstGenerator(object): 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 = {}