Message172806
| Author |
mattheww |
| Recipients |
mattheww |
| Date |
2012年10月13日.12:51:39 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1350132701.04.0.542395484982.issue16217@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年10月13日 12:51:41 | mattheww | set | recipients:
+ mattheww |
| 2012年10月13日 12:51:41 | mattheww | set | messageid: <1350132701.04.0.542395484982.issue16217@psf.upfronthosting.co.za> |
| 2012年10月13日 12:51:40 | mattheww | link | issue16217 messages |
| 2012年10月13日 12:51:39 | mattheww | create |
|