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

Tom de Vries <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
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(-)

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
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.