From 0212a718c766ba2834b3e39c7fa2146dcc2a2dc1 Mon Sep 17 00:00:00 2001 From: kaiisfree Date: Tue, 7 Apr 2026 06:00:14 +0600 Subject: [PATCH] Remove deprecated asyncio.iscoroutinefunction fallback (#3767) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `asyncio.iscoroutinefunction` call is deprecated in Python 3.14 and slated for removal in 3.16. Since `is_coroutine_function` already unwraps `functools.partial` layers before checking, the asyncio fallback is redundant on all supported Python versions — it can never return True when `inspect.iscoroutinefunction` returned False on the unwrapped function. Fixes #3765 Co-authored-by: Claude Opus 4.6 --- src/fastmcp/utilities/async_utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fastmcp/utilities/async_utils.py b/src/fastmcp/utilities/async_utils.py index 3f7e816fb..8fc24f49d 100644 --- a/src/fastmcp/utilities/async_utils.py +++ b/src/fastmcp/utilities/async_utils.py @@ -1,6 +1,5 @@ """Async utilities for FastMCP.""" -import asyncio import functools import inspect from collections.abc import Awaitable, Callable @@ -21,7 +20,7 @@ def is_coroutine_function(fn: Any) -> bool: """ while isinstance(fn, functools.partial): fn = fn.func - return inspect.iscoroutinefunction(fn) or asyncio.iscoroutinefunction(fn) + return inspect.iscoroutinefunction(fn) async def call_sync_fn_in_threadpool(