From 879c08cef4a8679ceab228869a9290c23e36edab Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Wed, 7 Oct 2026 11:17:27 -0500 Subject: [PATCH] Check future completion before setting result in ThrottledCallable --- src/superqt/utils/_throttler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/superqt/utils/_throttler.py b/src/superqt/utils/_throttler.py index 1eac0261..9616f069 100644 --- a/src/superqt/utils/_throttler.py +++ b/src/superqt/utils/_throttler.py @@ -286,7 +286,8 @@ def __call__(self, *args: P.args, **kwargs: P.kwargs) -> "Future[R]": # noqa def _set_future_result(self): result = self._func(*self._args[: self._max_args], **self._kwargs) - self._future.set_result(result) + if not self._future.done(): + self._future.set_result(result) def __set_name__(self, owner, name): if not self._is_static_method: