Walk a stack yielding the frame and line number for each frame. This will follow f.f_back from the given frame. If no frame is given, the current stack is used. Usually used with StackSummary.extract.
(f)
| 396 | |
| 397 | |
| 398 | def walk_stack(f): |
| 399 | """Walk a stack yielding the frame and line number for each frame. |
| 400 | |
| 401 | This will follow f.f_back from the given frame. If no frame is given, the |
| 402 | current stack is used. Usually used with StackSummary.extract. |
| 403 | """ |
| 404 | if f is None: |
| 405 | f = sys._getframe().f_back |
| 406 | |
| 407 | def walk_stack_generator(frame): |
| 408 | while frame is not None: |
| 409 | yield frame, frame.f_lineno |
| 410 | frame = frame.f_back |
| 411 | |
| 412 | return walk_stack_generator(f) |
| 413 | |
| 414 | |
| 415 | def walk_tb(tb): |
no test coverage detected
searching dependent graphs…