[Python-Dev] breaking an exception chain

Benjamin Peterson benjamin at python.org
Tue Aug 3 19:22:30 CEST 2010


2010/8/3 R. David Murray <rdmurray at bitdance.com>:
> Working with Catherine on an argparse bug, we ran into a test that was
> apparently failing by raising a SystemExit, when the test harness was
> supposed to be catching that error.  It took us a bit to realize that
> there wasn't really a SystemExit error, but that what we were seeing was
> the SystemExit chained to the exception the test harness was purposfully
> raising after catching the SystemExit.  In Python2, only the second,
> intentionally raised exception would be printed by unittest.  In Python3,
> the "main error" printed by unittest is the SystemExit, and the error
> raised by the test harness appears after the "while processing the above
> error" sentence.  Needless to say, this is a bit confusing.
>
> So I thought I'd break the exception chain before raising the error the
> test harness really wants to raise.  However, I can't figure out any way
> to do that.  Am I missing something, or this a missing feature?

Missing feature; there's a bug report somewhere.



-- 
Regards,
Benjamin


More information about the Python-Dev mailing list