From ffde6da87d35a26a4ba509b77b0db2f1a0248c1c Mon Sep 17 00:00:00 2001 From: kim Date: Tue, 8 Jul 2025 14:41:58 +0900 Subject: [PATCH] refactor: remove deprecated WebSocket fastapi_astack scope This scope was kept for compatibility but is no longer used by FastAPI. Removing it reduces WebSocket connection overhead. --- fastapi/routing.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index bf61a65c1..a49b91ef5 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -364,10 +364,6 @@ def get_websocket_app( ) -> Callable[[WebSocket], Coroutine[Any, Any, Any]]: async def app(websocket: WebSocket) -> None: async with AsyncExitStack() as async_exit_stack: - # TODO: remove this scope later, after a few releases - # This scope fastapi_astack is no longer used by FastAPI, kept for - # compatibility, just in case - websocket.scope["fastapi_astack"] = async_exit_stack solved_result = await solve_dependencies( request=websocket, dependant=dependant,