mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Prevent encoding errors when filenames are non-ASCII.
This commit is contained in:
parent
bb291e5045
commit
0dd23c2dc1
@ -449,7 +449,10 @@ class RstGenerator(object):
|
|||||||
|
|
||||||
# add content from attribute documentation
|
# add content from attribute documentation
|
||||||
if analyzer:
|
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()
|
attr_docs = analyzer.find_attr_docs()
|
||||||
if what in ('data', 'attribute'):
|
if what in ('data', 'attribute'):
|
||||||
key = ('.'.join(objpath[:-1]), objpath[-1])
|
key = ('.'.join(objpath[:-1]), objpath[-1])
|
||||||
@ -460,7 +463,7 @@ class RstGenerator(object):
|
|||||||
fullname, todoc)):
|
fullname, todoc)):
|
||||||
self.result.append(indent + line, sourcename, i)
|
self.result.append(indent + line, sourcename, i)
|
||||||
else:
|
else:
|
||||||
sourcename = 'docstring of %s' % fullname
|
sourcename = u'docstring of %s' % fullname
|
||||||
attr_docs = {}
|
attr_docs = {}
|
||||||
|
|
||||||
# add content from docstrings
|
# add content from docstrings
|
||||||
|
Loading…
Reference in New Issue
Block a user