From 70d1b27bf0d70adbffa863b52954214ce5eddfde Mon Sep 17 00:00:00 2001 From: miragecentury Date: Tue, 16 Sep 2025 00:31:42 +0200 Subject: [PATCH] fix: getattr side effects on dependencies implementing __getattr__ --- taskiq_dependencies/ctx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskiq_dependencies/ctx.py b/taskiq_dependencies/ctx.py index 204ada3..285a5e2 100644 --- a/taskiq_dependencies/ctx.py +++ b/taskiq_dependencies/ctx.py @@ -203,7 +203,7 @@ def resolver(self, executed_func: Any, initial_cache: Dict[Any, Any]) -> Any: :return: dict with resolved kwargs. """ - if getattr(executed_func, "dep_graph", False): + if inspect.getattr_static(executed_func, "dep_graph", False): ctx = SyncResolveContext(executed_func, self.main_graph, initial_cache) self.sub_contexts.append(ctx) sub_result = ctx.resolve_kwargs() @@ -331,7 +331,7 @@ async def resolver( :param initial_cache: cache to build a context if graph was passed. :return: dict with resolved kwargs. """ - if getattr(executed_func, "dep_graph", False): + if inspect.getattr_static(executed_func, "dep_graph", False): ctx = AsyncResolveContext(executed_func, self.main_graph, initial_cache) # type: ignore self.sub_contexts.append(ctx) sub_result = await ctx.resolve_kwargs()