def extract_stack(f=None, limit = None):
if f is None:<EOL><INDENT>try:<EOL><INDENT>raise ZeroDivisionError<EOL><DEDENT>except ZeroDivisionError:<EOL><INDENT>f = sys.exc_info()[<NUM_LIT:2>].tb_frame.f_back<EOL><DEDENT><DEDENT>if limit is None:<EOL><INDENT>if hasattr(sys, '<STR_LIT>'):<EOL><INDENT>limit = sys.tracebacklimit<EOL><DEDENT><DEDENT>list = []<EOL>n = <NUM_LIT:0><EOL>while f is not None and (limit is None or n < limit):<EOL><INDENT>lineno = f.f_lineno<EOL>co = f.f_code<EOL>filename = co.co_filename<EOL>name = co.co_name<EOL>linecache.checkcache(filename)<EOL>line = linecache.getline(filename, lineno, f.f_globals)<EOL>if line: line = line.strip()<EOL>else: line = None<EOL>list.append((filename, lineno, name, line))<EOL>f = f.f_back<EOL>n = n+<NUM_LIT:1><EOL><DEDENT>list.reverse()<EOL>return list<EOL>
Extract the raw traceback from the current stack frame.

    The return value has the same format as for extract_tb().  The
    optional 'f' and 'limit' arguments have the same meaning as for
    print_stack().  Each item in the list is a quadruple (filename,
    line number, function name, text), and the entries are in order
    from oldest to newest stack frame.