mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,  Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Subject: [PATCH net-next 2/8] tools: ynl: avoid bare except
Date: Tue, 09 Sep 2025 23:07:48 +0200	[thread overview]
Message-ID: <20250909-net-next-ynl-ruff-v1-2-238c2bccdd99@kernel.org> (raw)
In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org>

This 'except' was used without specifying the exception class according
to Ruff. Here, only the ValueError class is expected and handled.

This is linked to Ruff error E722 [1]:

  A bare except catches BaseException which includes KeyboardInterrupt,
  SystemExit, Exception, and others. Catching BaseException can make it
  hard to interrupt the program (e.g., with Ctrl-C) and can disguise
  other problems.

Link: https://docs.astral.sh/ruff/rules/bare-except/ [1]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 tools/net/ynl/pyynl/ethtool.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/net/ynl/pyynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py
index cab6b576c8762e0bb4e6ff730c7cf21cd9e1fa56..44440beab62f52f240e10f0678a6564f449d26d4 100755
--- a/tools/net/ynl/pyynl/ethtool.py
+++ b/tools/net/ynl/pyynl/ethtool.py
@@ -51,7 +51,7 @@ def print_field(reply, *desc):
     for spec in desc:
         try:
             field, name, tp = spec
-        except:
+        except ValueError:
             field, name = spec
             tp = 'int'
 

-- 
2.51.0


  parent reply	other threads:[~2025-09-09 21:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 21:07 [PATCH net-next 0/8] tools: ynl: fix errors reported by Ruff Matthieu Baerts (NGI0)
2025-09-09 21:07 ` [PATCH net-next 1/8] tools: ynl: fix undefined variable name Matthieu Baerts (NGI0)
2025-09-09 21:07 ` Matthieu Baerts (NGI0) [this message]
2025-09-09 21:07 ` [PATCH net-next 3/8] tools: ynl: remove assigned but never used variable Matthieu Baerts (NGI0)
2025-09-09 21:07 ` [PATCH net-next 4/8] tools: ynl: remove f-string without any placeholders Matthieu Baerts (NGI0)
2025-09-09 21:07 ` [PATCH net-next 5/8] tools: ynl: remove unused imports Matthieu Baerts (NGI0)
2025-09-09 21:07 ` [PATCH net-next 6/8] tools: ynl: remove unnecessary semicolons Matthieu Baerts (NGI0)
2025-09-09 21:07 ` [PATCH net-next 7/8] tools: ynl: use 'cond is None' Matthieu Baerts (NGI0)
2025-09-09 21:07 ` [PATCH net-next 8/8] tools: ynl: check for membership with 'not in' Matthieu Baerts (NGI0)
2025-09-10  8:53 ` [PATCH net-next 0/8] tools: ynl: fix errors reported by Ruff Donald Hunter
2025-09-10 23:16 ` Asbjørn Sloth Tønnesen
2025-09-11  1:20 ` patchwork-bot+netdevbpf

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=20250909-net-next-ynl-ruff-v1-2-238c2bccdd99@kernel.org \
    --to=matttbe@kernel.org \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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

all inboxes | Powered by JetHome®