From 7ae84add65ea8ca6dcd9dabe96dafd73924729ea Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Thu, 12 Mar 2026 22:37:34 +0100 Subject: [PATCH] specify ignore type Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com> --- fastapi/routing.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index ab0ea0b515..2f0dcc5268 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -100,8 +100,11 @@ def request_response( and returns an ASGI application. """ f: Callable[[Request], Awaitable[Response]] = ( - func if is_async_callable(func) else functools.partial(run_in_threadpool, func) # type:ignore # ty: ignore[unused-ignore-comment] - ) # ty: ignore + f: Callable[[Request], Awaitable[Response]] = ( + func # type: ignore[assignment] # ty: ignore[unused-ignore-comment] + if is_async_callable(func) + else functools.partial(run_in_threadpool, func) # type: ignore[call-arg] # ty: ignore[unused-ignore-comment] + ) # ty: ignore[invalid-assignment] async def app(scope: Scope, receive: Receive, send: Send) -> None: request = Request(scope, receive, send)