]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
♻️ Create `dependency-cache` dict in `solve_dependencies` only if `None` (don't re...
authorEvgeny Bokshitsky <e.bokshitskiy@hh.ru>
Sat, 20 Sep 2025 17:37:18 +0000 (21:37 +0400)
committerGitHub <noreply@github.com>
Sat, 20 Sep 2025 17:37:18 +0000 (19:37 +0200)
fastapi/dependencies/utils.py

index d9f6bf2d7bea0d4f7a3daeedfd0085fb1fdd62cd..8dd0a14c8a1d4ac7a5808759b2fcb57a10b3e4f3 100644 (file)
@@ -593,7 +593,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)
@@ -630,7 +631,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