| 768 | |
| 769 | |
| 770 | class FunctionFrame: |
| 771 | def __init__(self, capture, frame_no, func_id): |
| 772 | self.capture = capture |
| 773 | self.func_id = func_id |
| 774 | self.frame_no = frame_no |
| 775 | if frame_no > 100: |
| 776 | self.cap = False |
| 777 | else: |
| 778 | self.cap = True |
| 779 | |
| 780 | def __enter__(self): |
| 781 | if self.cap: |
| 782 | self.capture.startDetachedFrame("PYTHON_FUNCTION_CALL", "body", self.func_id) |
| 783 | |
| 784 | def __exit__(self, exc_type, exc_value, exc_tb): |
| 785 | if exc_type: |
| 786 | if self.cap: |
| 787 | self.capture.logTracedException(exc_value) |
| 788 | self.capture.addExceptionFrame(self.func_id, self.frame_no, exc_tb.tb_lineno, exc_value) |
| 789 | |
| 790 | if self.cap: |
| 791 | self.capture.endFrameType("PYTHON_FUNCTION_CALL") |
| 792 | |
| 793 | |
| 794 | class SplootCapture: |