Remove deprecated asyncio.iscoroutinefunction fallback (#3767)

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 <noreply@anthropic.com>
This commit is contained in:
kaiisfree 2026-04-07 06:00:14 +06:00 committed by GitHub
commit 0212a718c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(