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
This commit is contained in:
Andrew Svetlov 2019-05-16 17:52:10 +03:00 committed by Miss Islington (bot)
parent dbacfc2273
commit 68b34a7204
12 changed files with 311 additions and 320 deletions

View file

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