mirror of https://github.com/python/cpython
Fiddle with compact_traceback().
More whitespace cleanup.
This commit is contained in:
parent
a0378e1eda
commit
12e9668989
|
@ -463,21 +463,20 @@ class dispatcher_with_send(dispatcher):
|
|||
def compact_traceback():
|
||||
t, v, tb = sys.exc_info()
|
||||
tbinfo = []
|
||||
while 1:
|
||||
assert tb # Must have a traceback
|
||||
while tb:
|
||||
tbinfo.append((
|
||||
tb.tb_frame.f_code.co_filename,
|
||||
tb.tb_frame.f_code.co_name,
|
||||
str(tb.tb_lineno)
|
||||
))
|
||||
tb = tb.tb_next
|
||||
if not tb:
|
||||
break
|
||||
|
||||
# just to be safe
|
||||
del tb
|
||||
|
||||
file, function, line = tbinfo[-1]
|
||||
info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo)) + ']'
|
||||
info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo])
|
||||
return (file, function, line), t, v, info
|
||||
|
||||
def close_all(map=None):
|
||||
|
|
Loading…
Reference in New Issue