|
|
@@ -60,19 +60,23 @@ def _varDump__print(exc):
|
|
|
sReentry -= 1
|
|
|
|
|
|
oldExcepthook = None
|
|
|
-# store these values here so that Task.py can always reliably access these values
|
|
|
+# store these values here so that Task.py can always reliably access them
|
|
|
# from its main exception handler
|
|
|
wantVariableDump = False
|
|
|
dumpOnExceptionInit = False
|
|
|
|
|
|
-def _excepthookDumpVars(eType, eValue, traceback):
|
|
|
+class _AttrNotFound:
|
|
|
+ pass
|
|
|
+
|
|
|
+def _excepthookDumpVars(eType, eValue, tb):
|
|
|
s = 'DUMPING STACK FRAME VARIABLES'
|
|
|
- tb = traceback
|
|
|
+ origTb = tb
|
|
|
#import pdb;pdb.set_trace()
|
|
|
foundRun = False
|
|
|
while tb is not None:
|
|
|
frame = tb.tb_frame
|
|
|
code = frame.f_code
|
|
|
+ names = code.co_names
|
|
|
tb = tb.tb_next
|
|
|
# skip everything before the 'run' method, those frames have lots of
|
|
|
# not-useful information
|
|
|
@@ -84,13 +88,22 @@ def _excepthookDumpVars(eType, eValue, traceback):
|
|
|
s += '\n File "%s", line %s, in %s' % (
|
|
|
code.co_filename, frame.f_lineno, code.co_name)
|
|
|
for name, val in frame.f_locals.iteritems():
|
|
|
- r = fastRepr(val)
|
|
|
+ r = fastRepr(val, maxLen=10)
|
|
|
if type(r) is types.StringType:
|
|
|
r = r.replace('\n', '\\n')
|
|
|
s += '\n %s=%s' % (name, r)
|
|
|
+ # check if we should display any immediate attributes of the object
|
|
|
+ for n in names:
|
|
|
+ a = getattr(val, n, _AttrNotFound)
|
|
|
+ if a is not _AttrNotFound:
|
|
|
+ r = fastRepr(a, maxLen=10)
|
|
|
+ if type(r) is types.StringType:
|
|
|
+ r = r.replace('\n', '\\n')
|
|
|
+ s += '\n %s.%s=%s' % (name, n, r)
|
|
|
+
|
|
|
s += '\n'
|
|
|
notify.info(s)
|
|
|
- oldExcepthook(eType, eValue, traceback)
|
|
|
+ oldExcepthook(eType, eValue, origTb)
|
|
|
|
|
|
def install():
|
|
|
global oldExcepthook
|