Skip to content

Commit d8485d6

Browse files
Remove redundant _ensure_future in favor of ensure_future in asyncio (#102398)
1 parent 80b19a3 commit d8485d6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Lib/asyncio/tasks.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,6 @@ def ensure_future(coro_or_future, *, loop=None):
630630
631631
If the argument is a Future, it is returned directly.
632632
"""
633-
return _ensure_future(coro_or_future, loop=loop)
634-
635-
636-
def _ensure_future(coro_or_future, *, loop=None):
637633
if futures.isfuture(coro_or_future):
638634
if loop is not None and loop is not futures._get_loop(coro_or_future):
639635
raise ValueError('The future belongs to a different loop than '
@@ -798,7 +794,7 @@ def _done_callback(fut):
798794
outer = None # bpo-46672
799795
for arg in coros_or_futures:
800796
if arg not in arg_to_fut:
801-
fut = _ensure_future(arg, loop=loop)
797+
fut = ensure_future(arg, loop=loop)
802798
if loop is None:
803799
loop = futures._get_loop(fut)
804800
if fut is not arg:
@@ -855,7 +851,7 @@ def shield(arg):
855851
weak references to tasks. A task that isn't referenced elsewhere
856852
may get garbage collected at any time, even before it's done.
857853
"""
858-
inner = _ensure_future(arg)
854+
inner = ensure_future(arg)
859855
if inner.done():
860856
# Shortcut.
861857
return inner

0 commit comments

Comments
 (0)