Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #93852

Bug#1144982: [PATCH] rpcctl: SyntaxWarning: 'return' in a 'finally' block

From Salvatore Bonaccorso <carnil@debian.org>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#1144982: [PATCH] rpcctl: SyntaxWarning: 'return' in a 'finally' block
Date 2026-08-22 16:50 +0200
Message-ID <NuVcK-cwNM-5@gated-at.bofh.it> (permalink)
References <NurHH-cfRg-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


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

Back to linux.debian.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#1144982: python3.14 says /sbin/rpcctl:47: SyntaxWarning: 'return' in a 'finally' block "Trent W. Buck" <trentbuck@gmail.com> - 2026-08-21 09:20 +0200
  Bug#1144982: [PATCH] rpcctl: SyntaxWarning: 'return' in a 'finally' block Salvatore Bonaccorso <carnil@debian.org> - 2026-08-22 16:50 +0200
  Bug#1144982: marked as done (python3.14 says /sbin/rpcctl:47:  SyntaxWarning: 'return' in a 'finally' block) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2026-09-23 09:10 +0200

csiph-web