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

This commit is contained in:
Georg Brandl 2012-01-29 11:58:23 +01:00
parent 03152f8b60
commit 0c316f22eb
2 changed files with 6 additions and 0 deletions

View File

@ -38,6 +38,8 @@ Release 1.1.3 (in development)
* #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!
======================================================================

View File

@ -23,9 +23,11 @@ from docutils import nodes
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)
@ -231,6 +233,8 @@ Results of doctest builder run on %s
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):