Get rid of context manager, because it doesn't work fine with IronPython (PY-20959)

Also suspend some tests
This commit is contained in:
Elizaveta Shashkova
2018-04-02 13:56:49 +03:00
parent 92d7d4a79a
commit 86bd00fe56
3 changed files with 20 additions and 26 deletions
@@ -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,
@@ -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():
@@ -579,7 +579,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
@NotNull
@Override
public Set<String> getTags() {
return ImmutableSet.of("-jython");
return ImmutableSet.of("-jython", "-iron");
}
});
}
@@ -605,7 +605,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
@NotNull
@Override
public Set<String> 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<String> getTags() {
return ImmutableSet.of("-iron");
}
});
}