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 <noreply@anthropic.com>
This commit is contained in:
parent
b8fde76d7e
commit
7cbd828781
@ -1070,7 +1070,7 @@ class SettingsDialog:
|
|||||||
self._info("Loaded models successfully.")
|
self._info("Loaded models successfully.")
|
||||||
GLib.idle_add(apply)
|
GLib.idle_add(apply)
|
||||||
except Exception as e:
|
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()
|
threading.Thread(target=work, daemon=True).start()
|
||||||
|
|
||||||
def _ww_test(self, _b) -> None:
|
def _ww_test(self, _b) -> None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user