This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sonderblade
Recipients
Date 2005-02-09.10:44:35
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=51702

I like this idea alot! I usually debug by inserting print
"somevar
=",somevar around where I think the problem code is and this
patch
basically does it automagically for me. I can definitely
image this
patch saving me many hours of debug time. But:

1. It outputs to much information. An unhandled exception
that bubbles
   up can be 3-4 stackframes long and seeing all the
variables in
   those frames is excessive.

2. I think it would be better if the enhanced traceback was
either
   default or activated with a commandline option to Python.

Item 1 maybe can be solved by only outputting those names
that are
contained in the lines in which the exception is raised? So
that the
output in your example becomes:

Traceback (most recent call last):
  File "exception.py", line 20, in ?
    print g(i)
       g: <function g at 0x402efed4>
       i: 1
  File "exception.py", line 14, in g
    return a/(a-1)
       a: 1
ZeroDivisionError: integer division or modulo by zero

It feels a little weird to have to hook sys.excepthook. I
think this
idea is to good to be "buried" like that. Hopefully, with some
polishing it can be activated with a commandline option or
become the
default bahaviour. 
History
Date User Action Args
2007-08-23 15:41:12adminlinkissue1098732 messages
2007-08-23 15:41:12admincreate