diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-12-17 19:13:32 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-17 19:13:32 +0900 |
commit | 08c88729dd5af26c1b65d8cdfe52a105046be2d9 (patch) | |
tree | 84045126e557a35dc7cade61f50c570c31c355ab /sphinx/directives/code.py | |
parent | c7ed4f3ddd34013f56d21ad7b7da1d95563a1d51 (diff) | |
parent | d414471eed13828421fd5a3b86ac55cd15e2125a (diff) | |
download | sphinx-git-08c88729dd5af26c1b65d8cdfe52a105046be2d9.tar.gz |
Merge pull request #5813 from jdufresne/reporter-exc
Pass exceptions directly to docutils reporter
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r-- | sphinx/directives/code.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 77eba1762..3cb3a2d0a 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -14,7 +14,6 @@ from difflib import unified_diff from docutils import nodes from docutils.parsers.rst import directives from docutils.statemachine import StringList -from six import text_type from sphinx import addnodes from sphinx.deprecation import RemovedInSphinx40Warning @@ -143,7 +142,7 @@ class CodeBlock(SphinxDirective): hl_lines = [x + 1 for x in hl_lines if x < nlines] except ValueError as err: - return [document.reporter.warning(str(err), line=self.lineno)] + return [document.reporter.warning(err, line=self.lineno)] else: hl_lines = None @@ -170,7 +169,7 @@ class CodeBlock(SphinxDirective): try: literal = container_wrapper(self, literal, caption) except ValueError as exc: - return [document.reporter.warning(text_type(exc), line=self.lineno)] + return [document.reporter.warning(exc, line=self.lineno)] # literal will be note_implicit_target that is linked from caption and numref. # when options['name'] is provided, it should be primary ID. @@ -465,7 +464,7 @@ class LiteralInclude(SphinxDirective): return [retnode] except Exception as exc: - return [document.reporter.warning(text_type(exc), line=self.lineno)] + return [document.reporter.warning(exc, line=self.lineno)] def setup(app): |