(self, callable, slice_start=0, slice_end=-1)
| 642 | LEGACY = 0 |
| 643 | |
| 644 | def get_exception(self, callable, slice_start=0, slice_end=-1): |
| 645 | from _testcapi import exception_print |
| 646 | try: |
| 647 | callable() |
| 648 | self.fail("No exception thrown.") |
| 649 | except Exception as e: |
| 650 | with captured_output("stderr") as tbstderr: |
| 651 | exception_print(e, self.LEGACY) |
| 652 | return tbstderr.getvalue().splitlines()[slice_start:slice_end] |
| 653 | |
| 654 | callable_line = get_exception.__code__.co_firstlineno + 3 |
| 655 |
nothing calls this directly
no test coverage detected