[New-bugs-announce] [issue1312] doctest EXCEPTION_RE can't handle preceding output

Daniel Nouri report at bugs.python.org
Mon Oct 22 22:19:07 CEST 2007


New submission from Daniel Nouri:

doctest.DocTestParser._EXCEPTION_RE does not allow for output before the
actual traceback.

Attached is a simple test that demonstrates the problem.  This patch
fixes it:

--- /usr/lib/python2.5/doctest.py 2007-10-22 21:45:21.000000000 +0200
+++ /home/daniel/tmp/doctest.py       2007-10-22 22:19:12.000000000 +0200
@@ -513,7 +513,7 @@
     _EXCEPTION_RE = re.compile(r"""
         # Grab the traceback header.  Different versions of Python have
         # said different things on the first traceback line.
-        ^(?P<hdr> Traceback\ \(
+        .*^(?P<hdr> Traceback\ \(
             (?: most\ recent\ call\ last
             |   innermost\ last
             ) \) :


    _EXCEPTION_RE = re.compile(r"""
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        """, re.VERBOSE | re.MULTILINE | re.DOTALL)

----------
components: Library (Lib)
files: doctest-bug.py
messages: 56655
nosy: nouri
severity: normal
status: open
title: doctest EXCEPTION_RE can't handle preceding output
versions: Python 2.5
Added file: http://bugs.python.org/file8591/doctest-bug.py

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1312>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: doctest-bug.py
Type: text/x-python
Size: 302 bytes
Desc: not available
Url : http://mail.python.org/pipermail/new-bugs-announce/attachments/20071022/a822c701/attachment.py 


More information about the New-bugs-announce mailing list