summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-03-04 15:12:02 (GMT)
committerGeorg Brandl <georg@python.org>2012-03-04 15:12:02 (GMT)
commit50fdcdf086ec373df2e514dfbb0f8522dd95f05b (patch)
treed6f03cbb0c267ad14fb15c93fbb36b0ff2d09a45
parentc0eaecafe9809757301551285f2a41ea89f1f228 (diff)
downloadcpython-50fdcdf086ec373df2e514dfbb0f8522dd95f05b.zip
cpython-50fdcdf086ec373df2e514dfbb0f8522dd95f05b.tar.gz
cpython-50fdcdf086ec373df2e514dfbb0f8522dd95f05b.tar.bz2
Fix encoding handling of the pydoc-topics writer.
-rw-r--r--Doc/tools/sphinxext/pyspecific.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py
index d928cfd..f359530 100644
--- a/Doc/tools/sphinxext/pyspecific.py
+++ b/Doc/tools/sphinxext/pyspecific.py
@@ -5,7 +5,7 @@
Sphinx extension with Python doc-specific markup.
- :copyright: 2008, 2009, 2010 by Georg Brandl.
+ :copyright: 2008, 2009, 2010, 2011, 2012 by Georg Brandl.
:license: Python license.
"""
@@ -201,11 +201,12 @@ class PydocTopicsBuilder(Builder):
document.append(doctree.ids[labelid])
destination = StringOutput(encoding='utf-8')
writer.write(document, destination)
- self.topics[label] = str(writer.output)
+ self.topics[label] = writer.output.encode('utf-8')
def finish(self):
f = open(path.join(self.outdir, 'topics.py'), 'w')
try:
+ f.write('# -*- coding: utf-8 -*-\n')
f.write('# Autogenerated by Sphinx on %s\n' % asctime())
f.write('topics = ' + pformat(self.topics) + '\n')
finally: