rpcctl: SyntaxWarning: 'return' in a 'finally' block
Subsystems (2)
PATCH 1/1 rpcctl: SyntaxWarning: 'return' in a 'finally' block
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.
--- tools/rpcctl/rpcctl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/rpcctl/rpcctl.py +3 -2
@@ -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:
Signature · 1 line
2.55.0
Hi,
Quoted 33 lines · Salvatore Bonaccorso
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_filefunction.Replace the finally clause with an except BaseException, and dedent the return by one level up.
Reported-by "Trent W. Buck" <[email protected]>Signed-off-by Salvatore Bonaccorso <[email protected]>--- tools/rpcctl/rpcctl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tools/rpcctl/rpcctl.py +3
-2@@ -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:Signature · 1 line
2.55.0
Including Anna's oracle.com address.
Regards,
Salvatore
Quoted 11 lines · Salvatore Bonaccorso
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_filefunction.Replace the finally clause with an except BaseException, and dedent the return by one level up.
Committed... (tag: nfs-utils-2-9-3-rc2)
steved.
Quoted 20 lines
--- tools/rpcctl/rpcctl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tools/rpcctl/rpcctl.py +3
-2@@ -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:
Quoted 11 lines · Salvatore Bonaccorso
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_filefunction.Replace the finally clause with an except BaseException, and dedent the return by one level up.
Committed... (tag: nfs-utils-2-9-3-rc2)
steved.
Quoted 20 lines
--- tools/rpcctl/rpcctl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tools/rpcctl/rpcctl.py +3
-2@@ -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:
Quoted 11 lines · Salvatore Bonaccorso
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_filefunction.Replace the finally clause with an except BaseException, and dedent the return by one level up.
Committed... (tag: nfs-utils-2-9-3-rc2)
steved.
Quoted 20 lines
--- tools/rpcctl/rpcctl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tools/rpcctl/rpcctl.py +3
-2@@ -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: