Skip to content

Commit

Permalink
add wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 committed Dec 9, 2022
1 parent cd67c1b commit 3d473b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Lib/asyncio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from . import events
from . import exceptions
from . import futures
from .coroutines import _is_coroutine

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


@types.coroutine
def _wrap_awaitable(awaitable):
async def _wrap_awaitable(awaitable):
"""Helper for asyncio.ensure_future().
Wraps awaitable (an object with __await__) into a coroutine
that will later be wrapped in a Task by ensure_future().
"""
return (yield from awaitable.__await__())

_wrap_awaitable._is_coroutine = _is_coroutine
@types.coroutine
def wrapper(awaitable):
return (yield from awaitable.__await__())

return await wrapper(awaitable)

class _GatheringFuture(futures.Future):
"""Helper for gather().
Expand Down

0 comments on commit 3d473b8

Please sign in to comment.