File tree 1 file changed +6
-0
lines changed
Filter options
1 file changed +6
-0
lines changed
Original file line number Diff line number Diff line change 2
2
3
3
import fnmatch
4
4
import sys
5
+ import threading
5
6
import os
6
7
from inspect import CO_GENERATOR , CO_COROUTINE , CO_ASYNC_GENERATOR
7
8
@@ -36,9 +37,11 @@ def __init__(self):
36
37
self ._name = 'bdbtracer'
37
38
self ._tracefunc = None
38
39
self ._disable_current_event = False
40
+ self ._tracing_thread = None
39
41
40
42
def start_trace (self , tracefunc ):
41
43
self ._tracefunc = tracefunc
44
+ self ._tracing_thread = threading .current_thread ()
42
45
curr_tool = sys .monitoring .get_tool (self ._tool_id )
43
46
if curr_tool is None :
44
47
sys .monitoring .use_tool_id (self ._tool_id , self ._name )
@@ -57,6 +60,7 @@ def start_trace(self, tracefunc):
57
60
sys .monitoring .set_events (self ._tool_id , all_events )
58
61
59
62
def stop_trace (self ):
63
+ self ._tracing_thread = None
60
64
curr_tool = sys .monitoring .get_tool (self ._tool_id )
61
65
if curr_tool != self ._name :
62
66
return
@@ -78,6 +82,8 @@ def callback_wrapper(func):
78
82
79
83
@functools .wraps (func )
80
84
def wrapper (self , * args ):
85
+ if self ._tracing_thread != threading .current_thread ():
86
+ return
81
87
try :
82
88
frame = sys ._getframe ().f_back
83
89
ret = func (self , frame , * args )
You can’t perform that action at this time.
0 commit comments