Commits

Georg Brandl committed bc357df

Closes #844: Fix crashes when dealing with Unicode output in doctest extension.

  • Participants
  • Parent commits 9e3c369
  • Branches stable

Comments (0)

Files changed (2)

 * #834: Fix HTML help language/encoding mapping for all Sphinx supported
   languages.
 
+* #844: Fix crashes when dealing with Unicode output in doctest extension.
+
 
 Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
 ======================================================================

File sphinx/ext/doctest.py

 from docutils.parsers.rst import directives
 
 from sphinx.builders import Builder
+from sphinx.util import force_decode
 from sphinx.util.nodes import set_source_info
 from sphinx.util.compat import Directive
 from sphinx.util.console import bold
+from sphinx.util.pycompat import bytes
 
 blankline_re = re.compile(r'^\s*<BLANKLINE>', re.MULTILINE)
 doctestopt_re = re.compile(r'#\s*doctest:.+$', re.MULTILINE)
         self.info(text, nonl=True)
         if self.app.quiet:
             self.warn(text)
+        if isinstance(text, bytes):
+            text = force_decode(text, None)
         self.outfile.write(text)
 
     def get_target_uri(self, docname, typ=None):