MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / SetTrace

Function SetTrace

pydevd_tracing.py:96–113  ·  view source on GitHub ↗
(tracing_func)

Source from the content-addressed store, hash-verified

94
95
96def SetTrace(tracing_func):
97 if PYDEVD_USE_SYS_MONITORING:
98 raise RuntimeError("SetTrace should not be used when using sys.monitoring.")
99 _last_tracing_func_thread_local.tracing_func = tracing_func
100
101 if tracing_func is not None:
102 if set_trace_to_threads(tracing_func, thread_idents=[thread.get_ident()], create_dummy_thread=False) == 0:
103 # If we can use our own tracer instead of the one from sys.settrace, do it (the reason
104 # is that this is faster than the Python version because we don't call
105 # PyFrame_FastToLocalsWithError and PyFrame_LocalsToFast at each event!
106 # (the difference can be huge when checking line events on frames as the
107 # time increases based on the number of local variables in the scope)
108 # See: InternalCallTrampoline (on the C side) for details.
109 return
110
111 # If it didn't work (or if it was None), use the Python version.
112 set_trace = TracingFunctionHolder._original_tracing or sys.settrace
113 set_trace(tracing_func)
114
115
116def reapply_settrace():

Callers 1

reapply_settraceFunction · 0.85

Calls 1

set_trace_to_threadsFunction · 0.85

Tested by

no test coverage detected