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), a
(f=None, limit=None)
| 249 | |
| 250 | |
| 251 | def extract_stack(f=None, limit=None): |
| 252 | """Extract the raw traceback from the current stack frame. |
| 253 | |
| 254 | The return value has the same format as for extract_tb(). The |
| 255 | optional 'f' and 'limit' arguments have the same meaning as for |
| 256 | print_stack(). Each item in the list is a quadruple (filename, |
| 257 | line number, function name, text), and the entries are in order |
| 258 | from oldest to newest stack frame. |
| 259 | """ |
| 260 | if f is None: |
| 261 | f = sys._getframe().f_back |
| 262 | stack = StackSummary.extract(walk_stack(f), limit=limit) |
| 263 | stack.reverse() |
| 264 | return stack |
| 265 | |
| 266 | |
| 267 | def clear_frames(tb): |