MCPcopy Index your code
hub / github.com/python/cpython / get_exception

Method get_exception

Lib/test/test_traceback.py:644–652  ·  view source on GitHub ↗
(self, callable, slice_start=0, slice_end=-1)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

captured_outputFunction · 0.90
failMethod · 0.45
splitlinesMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected