(py_db, thread, frame, arg, exception_type)
| 1200 | # cdef object trace_obj; |
| 1201 | # ELSE |
| 1202 | def handle_exception(py_db, thread, frame, arg, exception_type): |
| 1203 | # ENDIF |
| 1204 | stopped = False |
| 1205 | try: |
| 1206 | # print('handle_exception', frame.f_lineno, frame.f_code.co_name) |
| 1207 | |
| 1208 | # We have 3 things in arg: exception type, description, traceback object |
| 1209 | trace_obj = arg[2] |
| 1210 | |
| 1211 | initial_trace_obj = trace_obj |
| 1212 | if trace_obj.tb_next is None and trace_obj.tb_frame is frame: |
| 1213 | # I.e.: tb_next should be only None in the context it was thrown (trace_obj.tb_frame is frame is just a double check). |
| 1214 | pass |
| 1215 | else: |
| 1216 | # Get the trace_obj from where the exception was raised... |
| 1217 | while trace_obj.tb_next is not None: |
| 1218 | trace_obj = trace_obj.tb_next |
| 1219 | |
| 1220 | if py_db.ignore_exceptions_thrown_in_lines_with_ignore_exception: |
| 1221 | for check_trace_obj in (initial_trace_obj, trace_obj): |
| 1222 | abs_real_path_and_base = get_abs_path_real_path_and_base_from_frame(check_trace_obj.tb_frame) |
| 1223 | absolute_filename = abs_real_path_and_base[0] |
| 1224 | canonical_normalized_filename = abs_real_path_and_base[1] |
| 1225 | |
| 1226 | lines_ignored = filename_to_lines_where_exceptions_are_ignored.get(canonical_normalized_filename) |
| 1227 | if lines_ignored is None: |
| 1228 | lines_ignored = filename_to_lines_where_exceptions_are_ignored[canonical_normalized_filename] = {} |
| 1229 | |
| 1230 | try: |
| 1231 | curr_stat = os.stat(absolute_filename) |
| 1232 | curr_stat = (curr_stat.st_size, curr_stat.st_mtime) |
| 1233 | except: |
| 1234 | curr_stat = None |
| 1235 | |
| 1236 | last_stat = filename_to_stat_info.get(absolute_filename) |
| 1237 | if last_stat != curr_stat: |
| 1238 | filename_to_stat_info[absolute_filename] = curr_stat |
| 1239 | lines_ignored.clear() |
| 1240 | try: |
| 1241 | linecache.checkcache(absolute_filename) |
| 1242 | except: |
| 1243 | pydev_log.exception("Error in linecache.checkcache(%r)", absolute_filename) |
| 1244 | |
| 1245 | from_user_input = py_db.filename_to_lines_where_exceptions_are_ignored.get(canonical_normalized_filename) |
| 1246 | if from_user_input: |
| 1247 | merged = {} |
| 1248 | merged.update(lines_ignored) |
| 1249 | # Override what we have with the related entries that the user entered |
| 1250 | merged.update(from_user_input) |
| 1251 | else: |
| 1252 | merged = lines_ignored |
| 1253 | |
| 1254 | exc_lineno = check_trace_obj.tb_lineno |
| 1255 | |
| 1256 | # print ('lines ignored', lines_ignored) |
| 1257 | # print ('user input', from_user_input) |
| 1258 | # print ('merged', merged, 'curr', exc_lineno) |
| 1259 |
no test coverage detected