def cleanup_traceback(tb, exclude):
 orig_tb = tb[:]
 while tb:
  for rpcfile in exclude:
   if tb[0][0].count(rpcfile):
    break
  else:
   break
  del tb[0]
 while tb:
  for rpcfile in exclude:
   if tb[(-1)][0].count(rpcfile):
    break
  else:
   break
  del tb[(-1)]
 if (len(tb) == 0):
  tb[:] = orig_tb[:]
  print >>sys.stderr, '** IDLE Internal Exception: '
 rpchandler = rpc.objecttable['exec'].rpchandler
 for i in range(len(tb)):
  (fn, ln, nm, line) = tb[i]
  if (nm == '?'):
   nm = '-toplevel-'
  if ((not line) and fn.startswith('<pyshell#')):
   line = rpchandler.remotecall('linecache', 'getline', (fn, ln), {})
  tb[i] = (fn, ln, nm, line)

def cleanup_traceback ( tb , exclude ) : orig_tb = tb [ : ] while tb : for rpcfile in exclude : if tb [ 0 ] [ 0 ] . count ( rpcfile ) : break else : break del tb [ 0 ] while tb : for rpcfile in exclude : if tb [ ( - 1 ) ] [ 0 ] . count ( rpcfile ) : break else : break del tb [ ( - 1 ) ] if ( len ( tb ) == 0 ) : tb [ : ] = orig_tb [ : ] print >> sys . stderr , '** IDLE Internal Exception: ' rpchandler = rpc . objecttable [ 'exec' ] . rpchandler for i in range ( len ( tb ) ) : ( fn , ln , nm , line ) = tb [ i ] if ( nm == '?' ) : nm = '-toplevel-' if ( ( not line ) and fn . startswith ( '<pyshell#' ) ) : line = rpchandler . remotecall ( 'linecache' , 'getline' , ( fn , ln ) , { } ) tb [ i ] = ( fn , ln , nm , line )
remove excluded traces from beginning/end of tb; get cached lines .