Extract frames from a traceback object.
(tb)
| 64 | |
| 65 | |
| 66 | def extract_traceback_frames(tb): |
| 67 | """Extract frames from a traceback object.""" |
| 68 | frames = [] |
| 69 | while tb: |
| 70 | if hasattr(tb, "tb_frame") and hasattr(tb, "tb_lineno"): |
| 71 | # Skip frames without source files |
| 72 | if Path(tb.tb_frame.f_code.co_filename).exists(): |
| 73 | frames.append((tb.tb_frame, tb.tb_lineno, getattr(tb, "tb_lasti", 0))) |
| 74 | tb = getattr(tb, "tb_next", None) |
| 75 | return frames |
| 76 | |
| 77 | |
| 78 | def filter_frames(frames): |
no test coverage detected