From a854251b94638caee768abef172b2b3fa9a9495a Mon Sep 17 00:00:00 2001 From: Dianjin Wang Date: Sat, 10 Oct 2026 15:47:44 +0800 Subject: [PATCH] Fix return in a finally block in buildMirrorSegments.py Python 3.14 (PEP 765) warns at compile time about a return in a finally block. Every gp* utility that imports gppylib.operations.buildMirrorSegments prints it on stderr: buildMirrorSegments.py:293: SyntaxWarning: 'return' in a 'finally' block This breaks tests that compare the output of those utilities, such as contrib/sslinfo, where "gpstop -arf" is run from the test and the two extra lines make the result differ from the expected file. In _update_config(), "return backout_map" was in the finally block that restores the SIGINT handler. A return there discards any exception from the try block, so a failure of updateSystemConfig() was silently ignored and None was returned. The caller then went on with the recovery, and _revert_config_update() failed later with a TypeError from len(None). Return after the finally block. The SIGINT handler is restored in the same way, and an exception from updateSystemConfig() is now raised to the caller with its own message, as every other step of the recovery does. This is the only return, break or continue in a finally block in the repository. Assisted-by: Claude Code Backpatch-through: REL_2_STABLE --- gpMgmt/bin/gppylib/operations/buildMirrorSegments.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gpMgmt/bin/gppylib/operations/buildMirrorSegments.py b/gpMgmt/bin/gppylib/operations/buildMirrorSegments.py index 2e5212357d0..869a37d312b 100644 --- a/gpMgmt/bin/gppylib/operations/buildMirrorSegments.py +++ b/gpMgmt/bin/gppylib/operations/buildMirrorSegments.py @@ -290,7 +290,8 @@ def _update_config(self, recovery_info_by_host, gpArray): finally: # Re-enable Ctrl-C signal.signal(signal.SIGINT, old_handler) - return backout_map + + return backout_map def _remove_progress_files(self, recovery_info_by_host, recovery_results): remove_progress_file_cmds = []