diff options
| author | Georg Brandl <georg@python.org> | 2012-01-29 10:29:44 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2012-01-29 10:29:44 +0100 |
| commit | dbe2066cd457d95e1253a9d208dd3c19a566d380 (patch) | |
| tree | 16f3314f5d3684a9558ca21329551f8aaf0c2532 | |
| parent | cdeb6c6dfddd24cb814d40da6a2eb75a9a98863e (diff) | |
| download | sphinx-dbe2066cd457d95e1253a9d208dd3c19a566d380.tar.gz | |
Closes #860: Do not crash when encountering invalid doctest examples, just emit a warning.
| -rw-r--r-- | CHANGES | 3 | ||||
| -rw-r--r-- | sphinx/ext/doctest.py | 9 |
2 files changed, 10 insertions, 2 deletions
@@ -17,6 +17,9 @@ Release 1.1.3 (in development) * #859: Fix exception under certain circumstances when not finding appropriate objects to link to. +* #860: Do not crash when encountering invalid doctest examples, just + emit a warning. + Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway! ====================================================================== diff --git a/sphinx/ext/doctest.py b/sphinx/ext/doctest.py index fdf4f2f4..3e329826 100644 --- a/sphinx/ext/doctest.py +++ b/sphinx/ext/doctest.py @@ -375,8 +375,13 @@ Doctest summary for code in group.tests: if len(code) == 1: # ordinary doctests (code/output interleaved) - test = parser.get_doctest(code[0].code, {}, group.name, - filename, code[0].lineno) + try: + test = parser.get_doctest(code[0].code, {}, group.name, + filename, code[0].lineno) + except Exception: + self.warn('ignoring invalid doctest code: %r' % code[0].code, + '%s:%s' % (filename, code[0].lineno)) + continue if not test.examples: continue for example in test.examples: |
