From 7c0a1e63a690baa0e85c636d7aba02297f263bb8 Mon Sep 17 00:00:00 2001 From: Evgeny Bokshitsky Date: Wed, 7 May 2025 01:42:30 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20remove=20non-required=20dependen?= =?UTF-8?q?cy-cache=20dict=20copy=20and=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi/dependencies/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index 84dfa4d03..90e1d1ea0 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -587,7 +587,8 @@ async def solve_dependencies( response = Response() del response.headers["content-length"] response.status_code = None # type: ignore - dependency_cache = dependency_cache or {} + if dependency_cache is None: + dependency_cache = {} sub_dependant: Dependant for sub_dependant in dependant.dependencies: sub_dependant.call = cast(Callable[..., Any], sub_dependant.call) @@ -624,7 +625,6 @@ async def solve_dependencies( embed_body_fields=embed_body_fields, ) background_tasks = solved_result.background_tasks - dependency_cache.update(solved_result.dependency_cache) if solved_result.errors: errors.extend(solved_result.errors) continue