mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-29051: Fix breakpoints on lines that throw exceptions
Those lines were hit the first time. The subsequent times incorrect caching prevented the breakpoints from activating Also minor: provide cython type for 'stop' local
This commit is contained in:
committed by
Elizaveta Shashkova
parent
fe2dc92e5c
commit
79a6ca9ad3
@@ -396,6 +396,7 @@ class PyDBFrame:
|
||||
# cdef bint is_return;
|
||||
# cdef str curr_func_name;
|
||||
# cdef bint exist_result;
|
||||
# cdef bint stop;
|
||||
# cdef dict frame_skips_cache;
|
||||
# cdef tuple frame_cache_key;
|
||||
# cdef tuple line_cache_key;
|
||||
@@ -620,7 +621,7 @@ class PyDBFrame:
|
||||
self.do_wait_suspend(thread, frame, event, arg)
|
||||
return self.trace_dispatch
|
||||
else:
|
||||
if not breakpoint and not is_return:
|
||||
if breakpoint is None and not (is_return or is_exception_event):
|
||||
# No stop from anyone and no breakpoint found in line (cache that).
|
||||
frame_skips_cache[line_cache_key] = 0
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
def fn_with_except():
|
||||
try:
|
||||
raise Exception()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def test_except():
|
||||
fn_with_except()
|
||||
fn_with_except()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_except()
|
||||
print('TEST SUCEEDED')
|
||||
@@ -226,6 +226,23 @@ class WriterThreadCase19(debugger_unittest.AbstractWriterThread):
|
||||
|
||||
self.finished_ok = True
|
||||
|
||||
#=======================================================================================================================
|
||||
# WriterThreadCase20 - [Test Case]: Breakpoint on line with exception
|
||||
#======================================================================================================================
|
||||
class WriterThreadCase20(debugger_unittest.AbstractWriterThread):
|
||||
|
||||
TEST_FILE = debugger_unittest._get_debugger_test_file('_debugger_case20.py')
|
||||
|
||||
def run(self):
|
||||
self.start_socket()
|
||||
self.write_add_breakpoint(3, 'fn_with_except')
|
||||
self.write_make_initial_run()
|
||||
for i in range(2):
|
||||
thread_id, frame_id, line = self.wait_for_breakpoint_hit('111', True)
|
||||
assert line == 3, 'Expected return to be in line 3, was: %s' % line
|
||||
self.write_run_thread(thread_id)
|
||||
|
||||
self.finished_ok = True
|
||||
|
||||
#=======================================================================================================================
|
||||
# WriterThreadCase18 - [Test Case]: change local variable
|
||||
@@ -1347,6 +1364,10 @@ class Test(unittest.TestCase, debugger_unittest.DebuggerRunner):
|
||||
def test_case_19(self):
|
||||
self.check_case(WriterThreadCase19)
|
||||
|
||||
# PY-29051
|
||||
def test_case_20(self):
|
||||
self.check_case(WriterThreadCase20)
|
||||
|
||||
if TEST_DJANGO:
|
||||
def test_case_django(self):
|
||||
self.check_case(WriterThreadCaseDjango)
|
||||
|
||||
Reference in New Issue
Block a user