From 2306fc1331dd4559dbc7e5fc6575a11e087ef160 Mon Sep 17 00:00:00 2001 From: DevilXD Date: Sat, 5 Nov 2022 19:25:50 +0100 Subject: [PATCH] ensure_future -> create_task --- gui.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui.py b/gui.py index 9e8a444..cd924fa 100644 --- a/gui.py +++ b/gui.py @@ -1922,12 +1922,12 @@ class GUIManager: # wait until the user closes the window await self._close_requested.wait() - async def coro_unless_closed(self, coro: abc.Awaitable[_T]) -> _T: + async def coro_unless_closed(self, coro: Any) -> _T: # In Python 3.11, we need to explicitly wrap awaitables - future: asyncio.Future[_T] = asyncio.ensure_future(coro) + task = asyncio.create_task(coro) done: set[asyncio.Task[Any]] done, pending = await asyncio.wait( - [future, self._close_requested.wait()], + [task, self._close_requested.wait()], return_when=asyncio.FIRST_COMPLETED, ) for task in pending: