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

Guido van Rossum guido at python.org
Sat Aug 18 21:46:59 CEST 2007


sys.last_traceback is the only place where you can reliably find the
latest *uncaught* traceback. There is no intention to get rid of it in
Py3k or to change this behavior. If you have another traceback you'd
like to print, you can use pdb.post_mortem(sys.exc_info()[2]).

On 8/18/07, Alexander Schremmer <2006a at usenet.alexanderweb.de> wrote:
> Hi there,
>
> when I tried 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 completly.
>
> 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
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list