From 68b34a720485f399e8699235b8f4e08f227dd43b Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 16 May 2019 17:52:10 +0300 Subject: bpo-36921: Deprecate @coroutine for sake of async def (GH-13346) The second attempt. Now deprecate `@coroutine` only, keep `yield from fut` as is. https://bugs.python.org/issue36921 --- Lib/asyncio/tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Lib/asyncio/tasks.py') diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 211b9126b01..b274b9bd332 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -23,7 +23,7 @@ from . import coroutines from . import events from . import exceptions from . import futures -from .coroutines import coroutine +from .coroutines import _is_coroutine # Helper to generate new task names # This uses itertools.count() instead of a "+= 1" operation because the latter @@ -638,7 +638,7 @@ def ensure_future(coro_or_future, *, loop=None): 'required') -@coroutine +@types.coroutine def _wrap_awaitable(awaitable): """Helper for asyncio.ensure_future(). @@ -647,6 +647,8 @@ def _wrap_awaitable(awaitable): """ return (yield from awaitable.__await__()) +_wrap_awaitable._is_coroutine = _is_coroutine + class _GatheringFuture(futures.Future): """Helper for gather(). -- cgit v1.2.3