From 2a1aff589db43b935a774e09bee2ba88e8287ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Tue, 6 Aug 2024 10:21:25 +0200 Subject: [PATCH] properly binding task method --- src/pydase/task/task.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pydase/task/task.py b/src/pydase/task/task.py index 30c7ca1..e9d6653 100644 --- a/src/pydase/task/task.py +++ b/src/pydase/task/task.py @@ -102,12 +102,6 @@ class Task(pydase.DataService, Generic[R]): def __get__(self, instance: Any, owner: Any) -> Self: # need to use this descriptor to bind the function to the instance of the class # containing the function - if instance and self._bound_func is not None: - - async def bound_func() -> R | None: - if not is_bound_method(self._func): - return await self._func(instance) - return None - - self._bound_func = bound_func + if instance and self._bound_func is None: + self._bound_func = self._func.__get__(instance, owner) return self