diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_dont_trace_files.py b/python/helpers/pydev/_pydevd_bundle/pydevd_dont_trace_files.py index cafbbebd987d..33bb9fa020cc 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_dont_trace_files.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_dont_trace_files.py @@ -18,7 +18,6 @@ DONT_TRACE = { 'linecache.py':LIB_FILE, 'threading.py':LIB_FILE, 'dis.py':LIB_FILE, - 'contextlib.py':LIB_FILE, #things from pydev that we don't want to trace '_pydev_execfile.py':PYDEV_FILE, diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_tracing.py b/python/helpers/pydev/_pydevd_bundle/pydevd_tracing.py index 912731abf865..86176a86af04 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_tracing.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_tracing.py @@ -69,22 +69,6 @@ def _internal_set_trace(tracing_func): TracingFunctionHolder._original_tracing(tracing_func) -@contextmanager -def _do_not_trace_ctx(): - current_thread = threading.currentThread() - do_not_trace_before = getattr(current_thread, 'pydev_do_not_trace', None) - if do_not_trace_before: - yield - return - current_thread.pydev_do_not_trace = True - try: - yield - except: - pass - finally: - current_thread.pydev_do_not_trace = do_not_trace_before - - def SetTrace(tracing_func, frame_eval_func=None, dummy_tracing_func=None): if tracing_func is not None and frame_eval_func is not None: # There is no need to set tracing function if frame evaluation is available @@ -96,14 +80,19 @@ def SetTrace(tracing_func, frame_eval_func=None, dummy_tracing_func=None): sys.settrace(tracing_func) return - with _do_not_trace_ctx(): + current_thread = threading.currentThread() + do_not_trace_before = getattr(current_thread, 'pydev_do_not_trace', None) + if do_not_trace_before: + return + try: TracingFunctionHolder._lock.acquire() - try: - TracingFunctionHolder._warn = False - _internal_set_trace(tracing_func) - TracingFunctionHolder._warn = True - finally: - TracingFunctionHolder._lock.release() + current_thread.pydev_do_not_trace = True # avoid settrace reentering + TracingFunctionHolder._warn = False + _internal_set_trace(tracing_func) + TracingFunctionHolder._warn = True + finally: + TracingFunctionHolder._lock.release() + current_thread.pydev_do_not_trace = do_not_trace_before def replace_sys_set_trace_func(): diff --git a/python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java b/python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java index 7858afe24c66..62418900eadc 100644 --- a/python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java +++ b/python/testSrc/com/jetbrains/env/python/PythonDebuggerTest.java @@ -579,7 +579,7 @@ public class PythonDebuggerTest extends PyEnvTestCase { @NotNull @Override public Set getTags() { - return ImmutableSet.of("-jython"); + return ImmutableSet.of("-jython", "-iron"); } }); } @@ -605,7 +605,7 @@ public class PythonDebuggerTest extends PyEnvTestCase { @NotNull @Override public Set getTags() { - return ImmutableSet.of("-jython"); + return ImmutableSet.of("-jython", "-iron"); } }); } @@ -1314,6 +1314,12 @@ public class PythonDebuggerTest extends PyEnvTestCase { eval("a").hasValue("2"); resume(); } + + @NotNull + @Override + public Set getTags() { + return ImmutableSet.of("-iron"); + } }); }