Issue1860
Created on 2008-01-17 13:26 by tzot, last changed 2008-01-17 13:59 by amaury.forgeotdarc.
| msg60028 (view) |
Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) |
Date: 2008-01-17 13:26 |
|
traceback.print_last() depends on the existence of sys.last_type,
sys.last_value, sys.last_traceback, which don't always exist when
called. See attached example file. I will shortly send the patch for
Lib/traceback.py
|
| msg60029 (view) |
Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) |
Date: 2008-01-17 13:42 |
|
I haven't submitted a patch since the transition from sf.net to
bugs.python.org; I assume that I don't have to open a new patch for
this, but if I have to, please let me know and I will gladly do it.
The unified diff is attached; the test example I issued works with the
patched version.
|
| msg60030 (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) |
Date: 2008-01-17 13:59 |
|
> traceback.print_last() depends on the existence of sys.last_type
Yes, that is exactly as documented:
>>> help(traceback.print_last)
Help on function print_last in module traceback:
print_last(limit=None, file=None)
This is a shorthand for 'print_exception(sys.last_type,
sys.last_value, sys.last_traceback, limit, file)'.
Furthermore, in the doc:
http://docs.python.org/dev/library/sys.html#sys.last_type
"... they are set when an exception is not handled ..."
In your script, you *are* handling the exception.
Your script really should use traceback.print_exc() instead.
BTW, your patch basically makes print_last() identical to print_exc()...
|
|
| Date |
User |
Action |
Args |
| 2008-01-17 13:59:20 | amaury.forgeotdarc | set | status: open -> closed resolution: invalid messages:
+ msg60030 nosy:
+ amaury.forgeotdarc |
| 2008-01-17 13:42:47 | tzot | set | files:
+ traceback_patch.diff messages:
+ msg60029 |
| 2008-01-17 13:26:57 | tzot | create | |
|