[Python-checkins] cpython: Fix encoding handling of the pydoc-topics writer.

georg.brandl python-checkins at python.org
Sun Mar 4 16:22:28 CET 2012


http://hg.python.org/cpython/rev/51347d4f080c
changeset:   75384:51347d4f080c
user:        Georg Brandl <georg at python.org>
date:        Sun Mar 04 16:12:02 2012 +0100
summary:
  Fix encoding handling of the pydoc-topics writer.

files:
  Doc/tools/sphinxext/pyspecific.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py
--- 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 @@
             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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list