(filename=None,
                                  orig_checkcache=linecache.checkcache)
Extend linecache.checkcache to preserve the <pyshell#...> entries

    Rather than repeating the linecache code, patch it to save the
    <pyshell#...> entries, call the original linecache.checkcache()
    (skipping them), and then restore the saved entries.

    orig_checkcache is bound at definition time to the original
    method, allowing it to be patched.
Extend linecache.checkcache to preserve the <pyshell#...> entries
Extend linecache . checkcache to preserve the <pyshell# ... > entries
def extended_linecache_checkcache(filename=None,
                                  orig_checkcache=linecache.checkcache):
    """Extend linecache.checkcache to preserve the <pyshell#...> entries

    Rather than repeating the linecache code, patch it to save the
    <pyshell#...> entries, call the original linecache.checkcache()
    (skipping them), and then restore the saved entries.

    orig_checkcache is bound at definition time to the original
    method, allowing it to be patched.
    """
    cache = linecache.cache
    save = {}
    for key in list(cache):
        if key[:1] + key[-1:] == '<>':
            save[key] = cache.pop(key)
    orig_checkcache(filename)
    cache.update(save)
def extended_linecache_checkcache ( filename = None , orig_checkcache = linecache . checkcache ) : cache = linecache . cache save = { } for key in list ( cache ) : if key [ : 1 ] + key [ - 1 : ] == '<>' : save [ key ] = cache . pop ( key ) orig_checkcache ( filename ) cache . update ( save )