diff --git a/stdlib/@tests/test_cases/asyncio/check_coroutines.py b/stdlib/@tests/test_cases/inspect/check_coroutines.py similarity index 95% rename from stdlib/@tests/test_cases/asyncio/check_coroutines.py rename to stdlib/@tests/test_cases/inspect/check_coroutines.py index 160bd896469e..f331c15cb081 100644 --- a/stdlib/@tests/test_cases/asyncio/check_coroutines.py +++ b/stdlib/@tests/test_cases/inspect/check_coroutines.py @@ -1,7 +1,7 @@ from __future__ import annotations -from asyncio import iscoroutinefunction from collections.abc import Awaitable, Callable, Coroutine +from inspect import iscoroutinefunction from typing import Any from typing_extensions import assert_type diff --git a/stdlib/asyncio/coroutines.pyi b/stdlib/asyncio/coroutines.pyi index 8ef30b3d3198..07366b5b204b 100644 --- a/stdlib/asyncio/coroutines.pyi +++ b/stdlib/asyncio/coroutines.pyi @@ -1,7 +1,7 @@ import sys from collections.abc import Awaitable, Callable, Coroutine from typing import Any, TypeVar, overload -from typing_extensions import ParamSpec, TypeGuard, TypeIs +from typing_extensions import ParamSpec, TypeGuard, TypeIs, deprecated # Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 11): @@ -17,11 +17,15 @@ if sys.version_info < (3, 11): def coroutine(func: _FunctionT) -> _FunctionT: ... @overload +@deprecated("Use inspect.iscoroutinefunction instead") def iscoroutinefunction(func: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ... @overload +@deprecated("Use inspect.iscoroutinefunction instead") def iscoroutinefunction(func: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, _T]]]: ... @overload +@deprecated("Use inspect.iscoroutinefunction instead") def iscoroutinefunction(func: Callable[_P, object]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ... @overload +@deprecated("Use inspect.iscoroutinefunction instead") def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ... def iscoroutine(obj: object) -> TypeIs[Coroutine[Any, Any, Any]]: ...