Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
kumaraditya303 committed Mar 10, 2023
commit 046458fb9f93f1b41fe2038f6bee82857d770894
9 changes: 3 additions & 6 deletions Lib/asyncio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,17 +634,14 @@ def ensure_future(coro_or_future, *, loop=None):
raise ValueError('The future belongs to a different loop than '
'the one specified as the loop argument')
return coro_or_future
should_close = False
should_close = True
if not coroutines.iscoroutine(coro_or_future):
if inspect.isawaitable(coro_or_future):
async def _wrap_awaitable(awaitable):
@types.coroutine
def wrapper():
return (yield from awaitable.__await__())
return await wrapper()
return await awaitable

coro_or_future = _wrap_awaitable(coro_or_future)
should_close = True
should_close = False
else:
raise TypeError('An asyncio.Future, a coroutine or an awaitable '
'is required')
Expand Down