def should_break(self, thread, ex_type, ex_value, trace):
probe_stack()
name = get_exception_name(ex_type)
mode = self.break_on.get(name, self.default_mode)
break_type = BREAK_TYPE_NONE
if mode & BREAK_MODE_ALWAYS:
if self.is_handled(thread, ex_type, ex_value, trace):
break_type = BREAK_TYPE_HANDLED
else:
break_type = BREAK_TYPE_UNHANDLED
elif (mode & BREAK_MODE_UNHANDLED) and not self.is_handled(thread, ex_type, ex_value, trace):
break_type = BREAK_TYPE_UNHANDLED
if break_type:
if issubclass(ex_type, SystemExit):
if not BREAK_ON_SYSTEMEXIT_ZERO:
if ((isinstance(ex_value, int) and not ex_value) or
(isinstance(ex_value, SystemExit) and not ex_value.code)):
break_type = BREAK_TYPE_NONE
return break_type
评论列表
文章目录