[1/5] Fix bare except in gdb/gdb-gdb.py.in

Message ID 20260720125056.1373177-2-tdevries@suse.de
State Superseded
Headers
Series Some pre-commit improvements |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Patch failed to apply

Commit Message

Tom de Vries July 20, 2026, 12:50 p.m. UTC
  Fix the following flake8 error:
...
gdb/gdb-gdb.py.in:97:9: E722 do not use bare 'except'
...

The problem is that bare except catches all exceptions, also SystemExit and
KeyboardInterrupt.

Fix this by using 'except Exception'.
---
 gdb/gdb-gdb.py.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gdb/gdb-gdb.py.in b/gdb/gdb-gdb.py.in
index 417b6492db5..8ed8169afa2 100644
--- a/gdb/gdb-gdb.py.in
+++ b/gdb/gdb-gdb.py.in
@@ -94,7 +94,7 @@  class TypeFlagsPrinter:
         TYPE_FLAGS = []
         try:
             iflags = gdb.lookup_type("enum type_instance_flag_value")
-        except:
+        except Exception:
             print("Warning: Cannot find enum type_instance_flag_value type.")
             print("         `struct type' pretty-printer will be degraded")
             return