From: Matthieu Baerts (NGI0) Date: Tue, 9 Sep 2025 21:07:48 +0000 (+0200) Subject: tools: ynl: avoid bare except X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=287bc89bb41fdb4c9433cbd9bedc240d53ce50ac;p=users%2Fhch%2Fmisc.git tools: ynl: avoid bare except 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) Reviewed-by: Donald Hunter Reviewed-by: Asbjørn Sloth Tønnesen Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-2-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski --- diff --git a/tools/net/ynl/pyynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py index cab6b576c876..44440beab62f 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'