diff options
author | Daniel Neuhäuser <ich@danielneuhaeuser.de> | 2010-06-03 17:33:50 +0200 |
---|---|---|
committer | Daniel Neuhäuser <ich@danielneuhaeuser.de> | 2010-06-03 17:33:50 +0200 |
commit | 0580c7c81a8b34a116d37ff4718ba632fb083858 (patch) | |
tree | e8801b4936b108d978f68efff87af7b80e3222e5 /sphinx/ext/autodoc.py | |
parent | 7c292a43d8301e278c3664c9d8bf4ddaccd1eccc (diff) | |
download | sphinx-git-0580c7c81a8b34a116d37ff4718ba632fb083858.tar.gz |
test if decoding is required first
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r-- | sphinx/ext/autodoc.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 1113f97a0..efb762e27 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -435,8 +435,11 @@ class Documenter(object): # set sourcename and add content from attribute documentation if self.analyzer: # prevent encoding errors when the file name is non-ASCII - filename = unicode(self.analyzer.srcname, - sys.getfilesystemencoding(), 'replace') + if not isinstance(self.analyzer.srcname, unicode): + filename = unicode(self.analyzer.srcname, + sys.getfilesystemencoding(), 'replace') + else: + filename = self.analyzer.srcname sourcename = u'%s:docstring of %s' % (filename, self.fullname) attr_docs = self.analyzer.find_attr_docs() |