Browse Source
Three `assert isinstance(...)` guards in routing.py are used as runtime checks for required ASGI scope keys (fastapi_middleware_astack, fastapi_inner_astack). Under `python -O`, all assert statements are stripped, converting these diagnostic guards into silent AttributeError exceptions with no context. Replace with explicit `if not isinstance(...): raise FastAPIError(...)` to preserve the error messages regardless of Python optimization level. Affects: - get_request_handler() HTTP middleware stack check (line 349) - get_request_handler() HTTP dependency stack check (line 418) - get_websocket_app() WebSocket dependency stack check (line 514)pull/14995/head
1 changed files with 12 additions and 9 deletions
Loading…
Reference in new issue