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 <ai.neo.ae86@gmail.com>
This commit is contained in:
Old-Ding 2026-07-06 01:34:16 +08:00
parent 1fc6f2bac8
commit a9e6460261
2 changed files with 3 additions and 3 deletions

View file

@ -284,7 +284,8 @@ class connectNuttx(object):
if self.method != "minicom":
time.sleep(0.5)
return ret
return ret
def switch_to_original_core(self):
if self.target == "target":

View file

@ -310,8 +310,7 @@ class NetCheck(gdb.Command):
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"):