From 6508dcf51d094d3c748269d6a3fb1a1acc26537a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 30 Jun 2021 02:13:08 +0200 Subject: [PATCH] Fix DeprecationWarning: "@coroutine" python[11090]: /var/www/yunorunner/./run.py:119: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead python[11090]: def wait_closed(self): --- run.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/run.py b/run.py index 20cea41..77711c7 100644 --- a/run.py +++ b/run.py @@ -115,8 +115,7 @@ def datetime_to_epoch_json_converter(o): return o.strftime('%s') -@asyncio.coroutine -def wait_closed(self): +async def wait_closed(self): """ Wait until the connection is closed. @@ -126,7 +125,7 @@ def wait_closed(self): of its cause, in tasks that interact with the WebSocket connection. """ - yield from asyncio.shield(self.connection_lost_waiter) + await asyncio.shield(self.connection_lost_waiter) # this is a backport of websockets 7.0 which sanic doesn't support yet