Since commit 56bcdbea2bed ("Let gdb.execute handle multi-line commands") command repetition after using the `gdb.execute` Python function fails (the previous command is not repeated anymore). This happens because read_command_lines_1 sets dont_repeat, but the call to prevent_dont_repeat in execute_gdb_command is later. The fix is to move the call to prevent_dont_repeat to the beginning of the function. Tested on my laptop (ArchLinux-x86_64) gdb/ChangeLog: PR python/#23714 * gdb/python/python.c (execute_gdb_command): call prevent_dont_repeat earlier to avoid affecting dont_repeat gdb/testuite/ChangeLog: PR python/#23714 * gdb.python/python.exp: Test gdb.execute("show commands"). --- gdb/python/python.c | 3 ++- gdb/testsuite/gdb.python/python.exp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)