[Python-Dev] sys.last_traceback - annoying pdb.pm behaviour

Alexander Schremmer 2006a at usenet.alexanderweb.de
Sat Aug 18 17:02:44 CEST 2007


Hi there,

when trying to use pdb, I spotted some kind of annoying behaviour of pdb:
for pdb.pm, it still uses sys.last_traceback which is set by code.py

This renders the function unusable in non-interactive contexts ... I suggest
to change pdb.pm to use sys.exc_traceback instead. Any reasons not to do
so?

For Py3k, it might make sense to kill it.

Besides that, some other places in the stdlib reference this attr as well:

idle in 5 places
./lib-tk/Tkinter.py:        sys.last_traceback = tb
./traceback.py:    sys.last_value, sys.last_traceback, limit, file)'."""
./traceback.py:    print_exception(sys.last_type, sys.last_value,
sys.last_traceback,
./pdb.py:    post_mortem(sys.last_traceback)
./code.py:        type, value, sys.last_traceback = sys.exc_info()
./code.py:            sys.last_traceback = tb
./dis.py:            tb = sys.last_traceback

Kind regards,
Alexander



More information about the Python-Dev mailing list