homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: doctest EXCEPTION_RE can't handle preceding output
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: jafo, nouri, tim.peters
Priority: normal Keywords: patch

Created on 2007年10月22日 20:19 by nouri, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
doctest-bug.py nouri, 2007年10月22日 20:19
Messages (2)
msg56655 - (view) Author: Daniel Nouri (nouri) Date: 2007年10月22日 20:19
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)
msg63810 - (view) Author: Sean Reifschneider (jafo) * (Python committer) Date: 2008年03月18日 00:04
The existing tests include a test explicitly for the existing behavior,
including the statement: "An example may not generate output before it
raises an exception". In order to be able to accept this change, there
is going to have to be discussion in python-dev or here about changing
the behavior.
History
Date User Action Args
2022年04月11日 14:56:27adminsetgithub: 45653
2008年03月18日 00:04:19jafosetstatus: open -> closed
nosy: + jafo
resolution: rejected
messages: + msg63810
priority: normal
2007年10月23日 19:39:58gvanrossumsetassignee: tim.peters
nosy: + tim.peters
2007年10月22日 20:31:01loewissetkeywords: + patch
2007年10月22日 20:19:06nouricreate

AltStyle によって変換されたページ (->オリジナル) /