New submission from Matthew Woodcraft:
If I run my code using 'python -m' and there is an unhandled exception, the
tracebacks include lines from runpy.py (and now sometimes from
importlib._bootstrap) which don't provide useful information, and tend to
overwhelm the valuable part of the traceback.
I suppose this is in some sense a regression from Python 2.4.
echo fail > fail.py
python3.3 -m fail
python -m fail
Traceback (most recent call last):
File "/usr/lib/python3.3/runpy.py", line 160, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python3.3/runpy.py", line 73, in _run_code
exec(code, run_globals)
File "./fail.py", line 2, in <module>
fail
NameError: name 'fail' is not defined
Here I think it would be better to omit the first two traceback entries.
Syntax errors are worse:
echo syntax error > fail.py
python3.3 -m fail
Traceback (most recent call last):
File "/usr/lib/python3.3/runpy.py", line 140, in _run_module_as_main
mod_name, loader, code, fname = _get_module_details(mod_name)
File "/usr/lib/python3.3/runpy.py", line 114, in _get_module_details
code = loader.get_code(mod_name)
File "<frozen importlib._bootstrap>", line 981, in get_code
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "./fail.py", line 1
syntax error
Here there are four traceback entries which could be omitted.
----------
messages: 172806
nosy: mattheww
priority: normal
severity: normal
status: open
title: Tracebacks are unnecessarily verbose when using 'python -m'
type: enhancement
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16217>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com