diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6ef99b..e32ee36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: pytest: strategy: matrix: - py_version: ["3.10", "3.11", "3.12", "3.13"] + py_version: ["3.10", "3.11", "3.12", "3.13", "3.14"] pydantic_ver: ["<2", ">=2.5,<3"] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: "${{ matrix.os }}" diff --git a/pyproject.toml b/pyproject.toml index 47bd43d..d37a148 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Intended Audience :: Developers", "Topic :: System :: Networking", diff --git a/taskiq/receiver/receiver.py b/taskiq/receiver/receiver.py index 39632f3..d72963b 100644 --- a/taskiq/receiver/receiver.py +++ b/taskiq/receiver/receiver.py @@ -2,6 +2,7 @@ import contextvars import functools import inspect +import sys from collections.abc import Callable from concurrent.futures import Executor from logging import getLogger @@ -23,6 +24,7 @@ from taskiq.utils import maybe_awaitable logger = getLogger(__name__) +PY_VERSION = sys.version_info QUEUE_DONE = b"-1" @@ -224,6 +226,11 @@ async def run_task( # noqa: C901, PLR0912, PLR0915 # Start a timer. start_time = time() + check_coroutine_func = ( + asyncio.iscoroutinefunction + if PY_VERSION <= (3, 13) + else inspect.iscoroutinefunction + ) try: # We put kwargs resolving here, # to be able to catch any exception (for example ), @@ -234,7 +241,7 @@ async def run_task( # noqa: C901, PLR0912, PLR0915 kwargs.update(message.kwargs) is_coroutine = True # If the function is a coroutine, we await it. - if asyncio.iscoroutinefunction(target): + if check_coroutine_func(target): target_future = target(*message.args, **kwargs) else: is_coroutine = False