Skip to content

Commit b9ff044

Browse files
committed
Add thread test in dispatch test
1 parent bc0c9c9 commit b9ff044

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

trepan/lib/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def get_option(key: str) -> Any:
6868

6969
self.bpmgr = BreakpointManager()
7070
self.current_bp = None
71+
self.current_thread = None
7172
self.debugger = debugger
7273

7374
# Threading lock ensures that we don't have other traced threads
@@ -400,6 +401,7 @@ def set_next(self, frame, step_ignore=0, step_events=None):
400401
self.stop_level = count_frames(frame)
401402
self.last_level = self.stop_level
402403
self.last_frame = frame
404+
self.current_thread = threading.current_thread()
403405
self.stop_on_finish = False
404406
self.step_ignore = step_ignore
405407
return
@@ -420,13 +422,14 @@ def trace_dispatch(self, frame, event: str, arg):
420422
# that we don't have any breakpoint set, since we have to check
421423
# for breakpoints in a kind of slow way of checking all events.
422424

423-
# TODO: add thread check
425+
424426
if (
425427
event == "call"
426428
and self.last_frame != frame
427429
and len(self.bpmgr.bplist) == 0
428430
and self.stop_level is not None
429431
and self.stop_level < count_frames(frame)
432+
and self.current_thread == threading.current_thread()
430433
):
431434
# We are "finish"ing or "next"ing and should not be tracing into this call
432435
# or any other calls from this. Return Nont to not trace further.

0 commit comments

Comments
 (0)