traceback.extract_stack()

traceback.extract_stack(f=None, limit=None)[source]

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.