[New-bugs-announce] [issue25708] runpy hides traceback for some exceptions

Cal Leeming report at bugs.python.org
Mon Nov 23 09:49:24 EST 2015

New submission from Cal Leeming:

Originally posted here:

The problem is caused by this line:

    # For -m switch, just display the exception
    info = str(exc)

Caused by the following commit in 2008;

The commit states;
"Try to make command line error messages from runpy easier to understand (and suppress traceback cruft from the implicitly invoked runpy machinery)"

However by suppressing the traceback it's now impossible to debug what caused the error when running with `runpy` without wrapping the entire `__init__.py` with your own try/except statement.

I'd like to propose either displaying the full traceback by default, or adding a CLI option to enable it at runtime. The fact that it only suppresses *some* tracebacks and not all is a flawed approach surely?


components: Interpreter Core
messages: 255169
nosy: ncoghlan, sleepycal
priority: normal
severity: normal
status: open
title: runpy hides traceback for some exceptions
type: behavior
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list