mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
test if decoding is required first
This commit is contained in:
parent
7c292a43d8
commit
0580c7c81a
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user