MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / is_unhandled_exception

Function is_unhandled_exception

_pydevd_bundle/pydevd_frame.py:78–112  ·  view source on GitHub ↗
(container_obj, py_db, frame, last_raise_line, raise_lines)

Source from the content-addressed store, hash-verified

76# def is_unhandled_exception(container_obj, py_db, frame, int last_raise_line, set raise_lines):
77# ELSE
78def is_unhandled_exception(container_obj, py_db, frame, last_raise_line, raise_lines):
79 # ENDIF
80 if frame.f_lineno in raise_lines:
81 return True
82
83 else:
84 try_except_infos = container_obj.try_except_infos
85 if try_except_infos is None:
86 container_obj.try_except_infos = try_except_infos = py_db.collect_try_except_info(frame.f_code)
87
88 if not try_except_infos:
89 # Consider the last exception as unhandled because there's no try..except in it.
90 return True
91 else:
92 # Now, consider only the try..except for the raise
93 valid_try_except_infos = []
94 for try_except_info in try_except_infos:
95 if try_except_info.is_line_in_try_block(last_raise_line):
96 valid_try_except_infos.append(try_except_info)
97
98 if not valid_try_except_infos:
99 return True
100
101 else:
102 # Note: check all, not only the "valid" ones to cover the case
103 # in "tests_python.test_tracing_on_top_level.raise_unhandled10"
104 # where one try..except is inside the other with only a raise
105 # and it's gotten in the except line.
106 for try_except_info in try_except_infos:
107 if try_except_info.is_line_in_except_block(frame.f_lineno):
108 if frame.f_lineno == try_except_info.except_line or frame.f_lineno in try_except_info.raise_lines_in_except:
109 # In a raise inside a try..except block or some except which doesn't
110 # match the raised exception.
111 return True
112 return False
113
114
115# IFDEF CYTHON

Callers 3

_unwind_eventFunction · 0.85
trace_exceptionMethod · 0.85

Calls 4

is_line_in_try_blockMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected