Doctest has new traceback gimmicks in 2.4.  While trying to document
them (which they are now), I had to rewrite the code to understand
it.  This has got to be the most DWIM part of doctest -- but in context
is really necessary.
diff --git a/Lib/doctest.py b/Lib/doctest.py
index fe23064..aa523a6 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -1191,16 +1191,27 @@
     #/////////////////////////////////////////////////////////////////
 
     # A regular expression for handling `want` strings that contain
-    # expected exceptions.  It divides `want` into two pieces: the
-    # pre-exception output (`out`) and the exception message (`exc`),
-    # as generated by traceback.format_exception_only().  (I assume
-    # that the exception_only message is the first non-indented line
-    # starting with word characters after the "Traceback ...".)
-    _EXCEPTION_RE = re.compile(('^(?P<out>.*)'
-                                '^(?P<hdr>Traceback \((?:%s|%s)\):)\s*$.*?'
-                                '^(?P<exc>\w+.*)') %
-                               ('most recent call last', 'innermost last'),
-                               re.MULTILINE | re.DOTALL)
+    # expected exceptions.  It divides `want` into three pieces:
+    #    - the pre-exception output (`want`)
+    #    - the traceback header line (`hdr`)
+    #    - the exception message (`msg`), as generated by
+    #      traceback.format_exception_only()
+    # `msg` may have multiple lines.  We assume/require that the
+    # exception message is the first non-indented line starting with a word
+    # character following the traceback header line.
+    _EXCEPTION_RE = re.compile(r"""
+        (?P<want> .*?)   # suck up everything until traceback header
+        # 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 traceback header
+        .*?    # don't blink:  absorb stuff until a line *starts* with \w
+        ^ (?P<msg> \w+ .*)
+        """, re.VERBOSE | re.MULTILINE | re.DOTALL)
 
     def __run(self, test, compileflags, out):
         """
@@ -1274,20 +1285,19 @@
                                                      exc_info)
                     failures += 1
                 else:
-                    exc_hdr = m.group('hdr')+'\n' # Exception header
+                    e_want, e_msg = m.group('want', 'msg')
                     # The test passes iff the pre-exception output and
                     # the exception description match the values given
                     # in `want`.
-                    if (self._checker.check_output(m.group('out'), got,
+                    if (self._checker.check_output(e_want, got,
                                                    self.optionflags) and
-                        self._checker.check_output(m.group('exc'), exc_msg,
+                        self._checker.check_output(e_msg, exc_msg,
                                                    self.optionflags)):
-                        # Is +exc_msg the right thing here??
                         self.report_success(out, test, example,
-                                       got+_exception_traceback(exc_info))
+                                       got + _exception_traceback(exc_info))
                     else:
                         self.report_failure(out, test, example,
-                                       got+_exception_traceback(exc_info))
+                                       got + _exception_traceback(exc_info))
                         failures += 1
 
         # Restore the option flags (in case they were modified)