Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] rpcctl: SyntaxWarning: 'return' in a 'finally' block
@ 2026-08-22 14:41 Salvatore Bonaccorso
  2026-08-22 15:11 ` Salvatore Bonaccorso
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Salvatore Bonaccorso @ 2026-08-22 14:41 UTC (permalink / raw)
  To: Anna Schumaker, Steve Dickson
  Cc: linux-nfs, 1144982, Salvatore Bonaccorso, Trent W. Buck

Trent W. Buck reported that when using rpcctl with Python 3.14
version, a SyntaxWarning warning is issued on the use of return in the
finally block in the read_info_file function.

Replace the finally clause with an except BaseException, and dedent the
return by one level up.

Reported-by: "Trent W. Buck" <trentbuck@gmail.com>
Link: https://docs.python.org/3/whatsnew/3.14.html#pep-765-control-flow-in-finally-blocks
Closes: https://bugs.debian.org/1144982
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
---
 tools/rpcctl/rpcctl.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py
index 29ae7d26f50e..42e238ca1c52 100755
--- a/tools/rpcctl/rpcctl.py
+++ b/tools/rpcctl/rpcctl.py
@@ -43,8 +43,9 @@ def read_info_file(path):
         with open(path) as info:
             lines = [line.split("=", 1) for line in info if "=" in line]
             res.update({key: int(val.strip()) for (key, val) in lines})
-    finally:
-        return res
+    except BaseException:
+        pass
+    return res
 
 
 class Xprt:
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-31 22:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-22 14:41 [PATCH] rpcctl: SyntaxWarning: 'return' in a 'finally' block Salvatore Bonaccorso
2026-08-22 15:11 ` Salvatore Bonaccorso
2026-08-31 22:57 ` Steve Dickson
2026-08-31 22:57 ` Steve Dickson
2026-08-31 22:58 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox