From a9e6460261ae58d9a2d639fdc9f145df816e2cea Mon Sep 17 00:00:00 2001 From: Old-Ding Date: Mon, 6 Jul 2026 01:34:16 +0800 Subject: [PATCH] tools: avoid returning from finally blocks Python warns about return statements inside finally blocks because they can suppress pending exceptions. Move the returns after the try/finally and try/except bodies so normal return values stay the same while unexpected exceptions are no longer swallowed. Signed-off-by: Old-Ding --- tools/ci/testrun/utils/common.py | 3 ++- tools/pynuttx/nxgdb/net.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci/testrun/utils/common.py b/tools/ci/testrun/utils/common.py index b5d76a68797ec..230369c2b1e9b 100644 --- a/tools/ci/testrun/utils/common.py +++ b/tools/ci/testrun/utils/common.py @@ -284,7 +284,8 @@ def sendCommand(self, cmd, *argc, **argv): if self.method != "minicom": time.sleep(0.5) - return ret + + return ret def switch_to_original_core(self): if self.target == "target": diff --git a/tools/pynuttx/nxgdb/net.py b/tools/pynuttx/nxgdb/net.py index 95f6680127f84..8e708320a84fc 100644 --- a/tools/pynuttx/nxgdb/net.py +++ b/tools/pynuttx/nxgdb/net.py @@ -310,8 +310,7 @@ def check_iob(self): result = max(result, NetCheckResult.FAILED) message.append("[FAILED] Failed to check IOB: %s" % e) - finally: - return result, message + return result, message def invoke(self, args, from_tty): if utils.get_symbol_value("CONFIG_MM_IOB"):