Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_trace(self, frame=None):
"""
"""
update_stdout()
wrap_sys_excepthook()
if frame is None:
frame = sys._getframe().f_back
#pdb = Tdb(def_colors)
self.reset()
self.set_step()
sys.settrace(self.trace_dispatch)
"""
exc_type, exc_value, exc_tb = sys.exc_info()
# If the exception has been annotated to be re-raised, raise the exception
if hasattr(exc_value, '_ipdbugger_let_raise'):
raise_(*sys.exc_info())
print()
for line in traceback.format_exception(exc_type, exc_value, exc_tb):
print(colored(line, 'red'), end=' ')
# Get the frame with the error.
test_frame = sys._getframe(-1).f_back
from ipdb.__main__ import wrap_sys_excepthook
wrap_sys_excepthook()
IPDBugger(exc_info=sys.exc_info()).set_trace(test_frame)