Skip to content

Commit 287bc89

Browse files
matttbekuba-moo
authored andcommitted
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) <[email protected]> Reviewed-by: Donald Hunter <[email protected]> Reviewed-by: Asbjørn Sloth Tønnesen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7a3aaaa commit 287bc89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/net/ynl/pyynl/ethtool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def print_field(reply, *desc):
5151
for spec in desc:
5252
try:
5353
field, name, tp = spec
54-
except:
54+
except ValueError:
5555
field, name = spec
5656
tp = 'int'
5757

0 commit comments

Comments
 (0)