(tb, exclude)
Remove excluded traces from beginning/end of tb; get cached lines
Remove excluded traces from beginning/end of tb; get cached lines
Remove excluded traces from beginning / end of tb ; get cached lines
def cleanup_traceback(tb, exclude):
    "Remove excluded traces from beginning/end of tb; get cached lines"
    orig_tb = tb[:]
    while tb:
        for rpcfile in exclude:
            if tb[0][0].count(rpcfile):
                break    # found an exclude, break for: and delete tb[0]
        else:
            break        # no excludes, have left RPC code, break while:
        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:
        # exception was in IDLE internals, don't prune!
        tb[:] = orig_tb[:]
        print("** IDLE Internal Exception: ", file=sys.stderr)
    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 # found an exclude, break for: and delete tb[0] else : break # no excludes, have left RPC code, break while: 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 : # exception was in IDLE internals, don't prune! tb [ : ] = orig_tb [ : ] print ( "** IDLE Internal Exception: " , file = sys . stderr ) 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