counted_command_line lines = read_command_lines_1 (reader, 1, nullptr);
 
-      scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0);
+      {
+       scoped_restore save_async = make_scoped_restore (¤t_ui->async,
+                                                        0);
 
-      scoped_restore save_uiout = make_scoped_restore (¤t_uiout);
+       scoped_restore save_uiout = make_scoped_restore (¤t_uiout);
 
-      /* Use the console interpreter uiout to have the same print format
-       for console or MI.  */
-      interp = interp_lookup (current_ui, "console");
-      current_uiout = interp->interp_ui_out ();
+       /* Use the console interpreter uiout to have the same print format
+          for console or MI.  */
+       interp = interp_lookup (current_ui, "console");
+       current_uiout = interp->interp_ui_out ();
 
-      scoped_restore preventer = prevent_dont_repeat ();
-      if (to_string)
-       to_string_res = execute_control_commands_to_string (lines.get (),
-                                                           from_tty);
-      else
-       execute_control_commands (lines.get (), from_tty);
+       scoped_restore preventer = prevent_dont_repeat ();
+       if (to_string)
+         to_string_res = execute_control_commands_to_string (lines.get (),
+                                                             from_tty);
+       else
+         execute_control_commands (lines.get (), from_tty);
+      }
+
+      /* Do any commands attached to breakpoint we stopped at.  */
+      bpstat_do_actions ();
     }
   CATCH (except, RETURN_MASK_ALL)
     {
     }
   END_CATCH
 
-  /* Do any commands attached to breakpoint we stopped at.  */
-  bpstat_do_actions ();
-
   if (to_string)
     return PyString_FromString (to_string_res.c_str ());
   Py_RETURN_NONE;