From 7cbd8287811bc9d1a0b9b87e47dd12a48b493fbc Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Mon, 8 Jun 2026 21:21:43 +0200 Subject: [PATCH] gtksettings: fix NameError in ww_load error lambda (Python 3.12 scoping) In Python 3.12 the 'except ... as e' variable is deleted after the except block exits, so a plain lambda that closes over 'e' raises NameError when GLib fires it later. Bind e as a default argument at lambda creation time. Co-Authored-By: Claude Sonnet 4.6 --- linux/blitztext/gtksettings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/blitztext/gtksettings.py b/linux/blitztext/gtksettings.py index 6a6b8c8..4052aa6 100644 --- a/linux/blitztext/gtksettings.py +++ b/linux/blitztext/gtksettings.py @@ -1070,7 +1070,7 @@ class SettingsDialog: self._info("Loaded models successfully.") GLib.idle_add(apply) except Exception as e: - GLib.idle_add(lambda: self._error(f"Failed to load models:\n{e}")) + GLib.idle_add(lambda e=e: self._error(f"Failed to load models:\n{e}")) threading.Thread(target=work, daemon=True).start() def _ww_test(self, _b) -> None: