Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/5] [gdb] Fix bare except in gdb/gdb-gdb.py.in
Date: Mon, 20 Jul 2026 14:50:52 +0200	[thread overview]
Message-ID: <20260720125056.1373177-2-tdevries@suse.de> (raw)
In-Reply-To: <20260720125056.1373177-1-tdevries@suse.de>

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


  reply	other threads:[~2026-07-20 12:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 12:50 [PATCH 0/5] [pre-commit] Some pre-commit improvements Tom de Vries
2026-07-20 12:50 ` Tom de Vries [this message]
2026-07-20 12:50 ` [PATCH 2/5] [gdb] Remove superfluous global in gdb/gdb-gdb.py.in Tom de Vries
2026-07-20 12:50 ` [PATCH 3/5] [pre-commit] Run flake8 for gdb/gdb-gdb.py.in Tom de Vries
2026-07-20 12:50 ` [PATCH 4/5] [pre-commit] Don't require text type for check-whitespace hook Tom de Vries
2026-07-20 12:50 ` [PATCH 5/5] [pre-commit] Don't require text type for codespell hook Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260720125056.1373177-2-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox