mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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:
parent
dbacfc2273
commit
68b34a7204
12 changed files with 311 additions and 320 deletions
|
@ -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().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue