Skip to content

Commit 03b8d33

Browse files
committed
Add thread test for next/finish level testing
1 parent 8a34c1d commit 03b8d33

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

trepan/lib/core.py

Lines changed: 3 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
@@ -106,6 +107,7 @@ def get_option(key: str) -> Any:
106107
# We also will cache the last frame and thread number encountered
107108
# so we don't have to compute the current level all the time.
108109
self.last_frame = None
110+
self.current_thread = threading.current_thread()
109111
self.last_level = 10000
110112
self.last_thread = None
111113
self.stop_level = None
@@ -420,13 +422,13 @@ 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
424425
if (
425426
event == "call"
426427
and self.last_frame != frame
427428
and len(self.bpmgr.bplist) == 0
428429
and self.stop_level is not None
429430
and self.stop_level < count_frames(frame)
431+
and self.current_thread == threading.current_thread()
430432
):
431433
# We are "finish"ing or "next"ing and should not be tracing into this call
432434
# or any other calls from this. Return Nont to not trace further.

0 commit comments

Comments
 (0)