mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Minors after review (PY-13540)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -470,7 +470,8 @@ class PyDBFrame: # No longer cdef because object was dying when only a reference
|
||||
if hasattr(frame, "f_back") and hasattr(frame.f_back, "f_locals"):
|
||||
frame.f_back.f_locals[RETURN_VALUES_PREFIX + name] = arg
|
||||
if main_debugger.remove_return_values_flag:
|
||||
# show return values was turned off, we should remove them from locals dict
|
||||
# Showing return values was turned off, we should remove them from locals dict.
|
||||
# The values can be in the current frame or in the back one
|
||||
for var_name in dict_keys(frame.f_locals):
|
||||
if var_name.startswith(RETURN_VALUES_PREFIX):
|
||||
dict_pop(frame.f_locals, var_name)
|
||||
@@ -565,7 +566,7 @@ class PyDBFrame: # No longer cdef because object was dying when only a reference
|
||||
|
||||
if can_skip and main_debugger.show_return_values:
|
||||
# trace function for showing return values after step over
|
||||
if info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop:
|
||||
if info.pydev_step_cmd == CMD_STEP_OVER and hasattr(frame, "f_back") and frame.f_back == info.pydev_step_stop:
|
||||
can_skip = False
|
||||
|
||||
# Let's check to see if we are in a function that has a breakpoint. If we don't have a breakpoint,
|
||||
|
||||
@@ -273,7 +273,8 @@ class PyDBFrame: # No longer cdef because object was dying when only a reference
|
||||
if hasattr(frame, "f_back") and hasattr(frame.f_back, "f_locals"):
|
||||
frame.f_back.f_locals[RETURN_VALUES_PREFIX + name] = arg
|
||||
if main_debugger.remove_return_values_flag:
|
||||
# show return values was turned off, we should remove them from locals dict
|
||||
# Showing return values was turned off, we should remove them from locals dict.
|
||||
# The values can be in the current frame or in the back one
|
||||
for var_name in dict_keys(frame.f_locals):
|
||||
if var_name.startswith(RETURN_VALUES_PREFIX):
|
||||
dict_pop(frame.f_locals, var_name)
|
||||
@@ -368,7 +369,7 @@ class PyDBFrame: # No longer cdef because object was dying when only a reference
|
||||
|
||||
if can_skip and main_debugger.show_return_values:
|
||||
# trace function for showing return values after step over
|
||||
if info.pydev_step_cmd == CMD_STEP_OVER and frame.f_back == info.pydev_step_stop:
|
||||
if info.pydev_step_cmd == CMD_STEP_OVER and hasattr(frame, "f_back") and frame.f_back == info.pydev_step_stop:
|
||||
can_skip = False
|
||||
|
||||
# Let's check to see if we are in a function that has a breakpoint. If we don't have a breakpoint,
|
||||
|
||||
@@ -309,7 +309,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
public void init() {
|
||||
getSession().rebuildViews();
|
||||
registerBreakpoints();
|
||||
setShowReturnValues(PyDebuggerSettings.getInstance().WATCH_RETURN_VALUES);
|
||||
setShowReturnValues(PyDebuggerSettings.getInstance().watchReturnValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -413,17 +413,17 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
@NotNull DefaultActionGroup topToolbar,
|
||||
@NotNull DefaultActionGroup settings) {
|
||||
super.registerAdditionalActions(leftToolbar, topToolbar, settings);
|
||||
settings.add(new WatchLastMethodReturnValueAction(this));
|
||||
settings.add(new WatchReturnValuesAction(this));
|
||||
}
|
||||
|
||||
private static class WatchLastMethodReturnValueAction extends ToggleAction {
|
||||
private static class WatchReturnValuesAction extends ToggleAction {
|
||||
private volatile boolean myWatchesReturnValues;
|
||||
private final PyDebugProcess myProcess;
|
||||
private final String myText;
|
||||
|
||||
public WatchLastMethodReturnValueAction(@NotNull PyDebugProcess debugProcess) {
|
||||
public WatchReturnValuesAction(@NotNull PyDebugProcess debugProcess) {
|
||||
super("", "Enables watching executed functions return values", null);
|
||||
myWatchesReturnValues = PyDebuggerSettings.getInstance().WATCH_RETURN_VALUES;
|
||||
myWatchesReturnValues = PyDebuggerSettings.getInstance().watchReturnValues;
|
||||
myProcess = debugProcess;
|
||||
myText = "Show Return Values";
|
||||
}
|
||||
@@ -444,7 +444,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean watch) {
|
||||
myWatchesReturnValues = watch;
|
||||
PyDebuggerSettings.getInstance().WATCH_RETURN_VALUES = watch;
|
||||
PyDebuggerSettings.getInstance().watchReturnValues = watch;
|
||||
final Project project = e.getProject();
|
||||
if (project != null) {
|
||||
myProcess.setShowReturnValues(myWatchesReturnValues);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class PyDebuggerSettings extends XDebuggerSettings<PyDebuggerSettings> im
|
||||
private boolean mySteppingFiltersEnabled;
|
||||
private @NotNull List<PySteppingFilter> mySteppingFilters;
|
||||
public static final String FILTERS_DIVIDER = ";";
|
||||
public volatile boolean WATCH_RETURN_VALUES = false;
|
||||
public volatile boolean watchReturnValues = false;
|
||||
|
||||
public PyDebuggerSettings() {
|
||||
super("python");
|
||||
|
||||
@@ -918,13 +918,13 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
toggleBreakpoint(getScriptPath(), 7);
|
||||
toggleBreakpoint(getScriptPath(), 11);
|
||||
final PyDebuggerSettings debuggerSettings = PyDebuggerSettings.getInstance();
|
||||
debuggerSettings.WATCH_RETURN_VALUES = true;
|
||||
debuggerSettings.watchReturnValues = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFinally() {
|
||||
final PyDebuggerSettings debuggerSettings = PyDebuggerSettings.getInstance();
|
||||
debuggerSettings.WATCH_RETURN_VALUES = false;
|
||||
debuggerSettings.watchReturnValues = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user