From 156868da5ae3319ad53dad1502a6a5492a0c9be1 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Sat, 30 May 2026 09:07:38 +0800 Subject: [PATCH] gladevcp: move return out of finally in SAVE_PROGRAM gtk_action.py had 'return npath' inside a finally: block. A return in finally swallows any in-flight exception and overrides earlier returns, so the except branch's 'return None' (the error path) was always clobbered: a failed save still returned the path and hid the exception. Dedent the return out of the finally so the finally only closes the file. On success the function returns npath; on a write error it now correctly returns None. Also silences the Python 3.12+ SyntaxWarning: 'return' in a 'finally' block. Surfaced by the ui-smoke tests (PR #4054). Fixes #4067 --- lib/python/gladevcp/gtk_action.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/python/gladevcp/gtk_action.py b/lib/python/gladevcp/gtk_action.py index c7eb96d3671..247d9df4e93 100644 --- a/lib/python/gladevcp/gtk_action.py +++ b/lib/python/gladevcp/gtk_action.py @@ -309,7 +309,7 @@ def SAVE_PROGRAM(self, source, fname, ending = '.ngc'): outfile.close() except: pass - return npath + return npath def SET_AXIS_ORIGIN(self, axis, value): if axis == '' or axis.upper() not in ("XYZABCUVW"):