Message47499
I think it would be useful to sometimes have local variable
values printed with tracebacks and stack frames. The
attached patch is a first cut at that. I don't know if
people would want that as the default, so I've defaulted
argument printing to disabled. With arg printing enabled,
executing this script:
#!/usr/bin/env python
import sys
import traceback
def exch(ty, val, tb):
traceback.print_exception(ty, val, tb, args=True)
sys.excepthook = exch
def f(n,d):
return n/d
def g(a):
return a/(a-1)
for i in range(5,-1,-1):
print g(i)
displays this output:
1
1
1
2
Traceback (most recent call last):
File "/Users/skip/tmp/tb.py", line 17, in ?
print g(i)
exch: <function exch at 0x4c46b0>
f: <function f at 0x441330>
g: <function g at 0x441370>
i: 1
File "/Users/skip/tmp/tb.py", line 14, in g
return a/(a-1)
a: 1
ZeroDivisionError: integer division or modulo by zero
|
|
Date |
User |
Action |
Args |
2007-08-23 15:41:12 | admin | link | issue1098732 messages |
2007-08-23 15:41:12 | admin | create | |
|