[New-bugs-announce] [issue10986] traceback's rendering behavior while throwing custom exception

Benjamin VENELLE report at bugs.python.org
Sun Jan 23 03:47:00 CET 2011

New submission from Benjamin VENELLE <gu0sur20 at gmail.com>:


>From few days, I've acknowledge when throwing an exception, the last traceback entry is always related to the raise statement. This is ok when the exception takes source from a non fail-safe code. But when an exception is raised due to a function's inputs sanity check (like an assertion error) the last traceback entry is non-sense. I've done a script to spot this behavior.

Is there a way to prevent last traceback rendering (not suppressing) while exception is displayed without explicit call to traceback.print_exception ? If not, it would be useful to have a boolean declared in Exception's classes which will allow last traceback entry rendering or not.

components: Interpreter Core
files: traceback_rendering.py
messages: 126871
nosy: Kain94
priority: normal
severity: normal
status: open
title: traceback's rendering behavior while throwing custom exception
type: feature request
versions: Python 3.1
Added file: http://bugs.python.org/file20488/traceback_rendering.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list