summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-01-22 20:12:40 +0100
committerGeorg Brandl <georg@python.org>2009-01-22 20:12:40 +0100
commit0dd23c2dc12144d12264932acbe30d79e03c1ffe (patch)
tree3a0f416bca053bcd7e973542083e3e61b4e69de6 /sphinx/ext/autodoc.py
parentbb291e504578817d0b9f8db135176af9e398182c (diff)
downloadsphinx-git-0dd23c2dc12144d12264932acbe30d79e03c1ffe.tar.gz
Prevent encoding errors when filenames are non-ASCII.
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r--sphinx/ext/autodoc.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index d0512f2be..3ca92e86b 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -449,7 +449,10 @@ class RstGenerator(object):
# add content from attribute documentation
if analyzer:
- sourcename = '%s:docstring of %s' % (analyzer.srcname, fullname)
+ # prevent encoding errors when the file name is non-ASCII
+ srcname = unicode(analyzer.srcname,
+ sys.getfilesystemencoding(), 'replace')
+ sourcename = u'%s:docstring of %s' % (srcname, fullname)
attr_docs = analyzer.find_attr_docs()
if what in ('data', 'attribute'):
key = ('.'.join(objpath[:-1]), objpath[-1])
@@ -460,7 +463,7 @@ class RstGenerator(object):
fullname, todoc)):
self.result.append(indent + line, sourcename, i)
else:
- sourcename = 'docstring of %s' % fullname
+ sourcename = u'docstring of %s' % fullname
attr_docs = {}
# add content from docstrings