summaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 7e34d2638cc..e478ec955ca 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -319,11 +319,9 @@ static void
python_interactive_command (char *arg, int from_tty)
{
struct ui *ui = current_ui;
- struct cleanup *cleanup;
int err;
- cleanup = make_cleanup_restore_integer (&current_ui->async);
- current_ui->async = 0;
+ scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
arg = skip_spaces (arg);
@@ -351,8 +349,6 @@ python_interactive_command (char *arg, int from_tty)
gdbpy_print_stack ();
error (_("Error while executing Python code."));
}
-
- do_cleanups (cleanup);
}
/* A wrapper around PyRun_SimpleFile. FILE is the Python script to run
@@ -467,8 +463,7 @@ python_command (char *arg, int from_tty)
cleanup = ensure_python_env (get_current_arch (), current_language);
- make_cleanup_restore_integer (&current_ui->async);
- current_ui->async = 0;
+ scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
arg = skip_spaces (arg);
if (arg && *arg)
@@ -651,8 +646,7 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
struct cleanup *cleanup = make_cleanup (xfree, copy);
struct interp *interp;
- make_cleanup_restore_integer (&current_ui->async);
- current_ui->async = 0;
+ scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
make_cleanup_restore_current_uiout ();