From: Sebastián Ramírez Date: Mon, 27 Jul 2026 14:06:31 +0000 (+0200) Subject: ⚡️ Stop retaining flat dependency trees (#16065) X-Git-Tag: 0.140.2~2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=8069eadf5e12235bcbbdd2d3bafe5226c585e997;p=thirdparty%2Ffastapi%2Ffastapi.git ⚡️ Stop retaining flat dependency trees (#16065) Co-authored-by: Marcelo Trylesinski --- diff --git a/fastapi/routing.py b/fastapi/routing.py index f3ff6c172e..125ab51ae7 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -807,7 +807,7 @@ class APIWebSocketRoute(routing.WebSocketRoute): self.path_regex, self.path_format, self.param_convertors = compile_path(path) ( self.dependant, - self._flat_dependant, + _, self._embed_body_fields, ) = _build_dependant_with_parameterless_dependencies( path=self.path_format, @@ -944,7 +944,6 @@ class _APIRouteLike(Protocol): description: str response_fields: dict[int | str, ModelField] dependant: Dependant - _flat_dependant: Dependant _embed_body_fields: bool body_field: ModelField | None is_sse_stream: bool @@ -1091,7 +1090,7 @@ def _populate_api_route_state( assert callable(endpoint), "An endpoint must be a callable" ( route.dependant, - route._flat_dependant, + flat_dependant, route._embed_body_fields, ) = _build_dependant_with_parameterless_dependencies( path=route.path_format, @@ -1099,7 +1098,7 @@ def _populate_api_route_state( dependencies=route.dependencies, ) route.body_field = get_body_field( - flat_dependant=route._flat_dependant, + flat_dependant=flat_dependant, name=route.unique_id, embed_body_fields=route._embed_body_fields, ) @@ -1145,7 +1144,6 @@ class APIRoute(routing.Route): description: str response_fields: dict[int | str, ModelField] dependant: Dependant - _flat_dependant: Dependant _embed_body_fields: bool body_field: ModelField | None is_sse_stream: bool @@ -1410,7 +1408,6 @@ class _EffectiveRouteContext: description: str = "" response_fields: dict[int | str, ModelField] = field(default_factory=dict) dependant: Dependant | None = None - _flat_dependant: Dependant | None = None _embed_body_fields: bool = False body_field: ModelField | None = None is_sse_stream: bool = False @@ -1486,7 +1483,7 @@ class _EffectiveRouteContext: ) ( context.dependant, - context._flat_dependant, + _, context._embed_body_fields, ) = _build_dependant_with_parameterless_dependencies( path="", @@ -2080,7 +2077,7 @@ class _FrontendRouteGroup(BaseRoute): self.dependency_overrides_provider = dependency_overrides_provider ( self.dependant, - self._flat_dependant, + _, self._embed_body_fields, ) = _build_dependant_with_parameterless_dependencies( path="",