Skip to content

Commit 3d473b8

Browse files
add wrapper
1 parent cd67c1b commit 3d473b8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/asyncio/tasks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from . import events
2525
from . import exceptions
2626
from . import futures
27-
from .coroutines import _is_coroutine
2827

2928
# Helper to generate new task names
3029
# This uses itertools.count() instead of a "+= 1" operation because the latter
@@ -677,17 +676,18 @@ def _ensure_future(coro_or_future, *, loop=None):
677676
raise
678677

679678

680-
@types.coroutine
681-
def _wrap_awaitable(awaitable):
679+
async def _wrap_awaitable(awaitable):
682680
"""Helper for asyncio.ensure_future().
683681
684682
Wraps awaitable (an object with __await__) into a coroutine
685683
that will later be wrapped in a Task by ensure_future().
686684
"""
687-
return (yield from awaitable.__await__())
688685

689-
_wrap_awaitable._is_coroutine = _is_coroutine
686+
@types.coroutine
687+
def wrapper(awaitable):
688+
return (yield from awaitable.__await__())
690689

690+
return await wrapper(awaitable)
691691

692692
class _GatheringFuture(futures.Future):
693693
"""Helper for gather().

0 commit comments

Comments
 (0)