From c923dbfb587a7f2135beae08b28d4a06d60ab186 Mon Sep 17 00:00:00 2001 From: Javier Marcet Date: Mon, 24 Jan 2022 16:18:53 +0100 Subject: [PATCH 1/2] Fix "DeprecationWarning: There is no current event loop" Signed-off-by: Javier Marcet --- sanic/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sanic/app.py b/sanic/app.py index 5f3a0438f9..4c84075309 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -12,6 +12,7 @@ Task, ensure_future, get_event_loop, + get_event_loop_policy, get_running_loop, wait_for, ) @@ -254,7 +255,7 @@ def loop(self): "Loop can only be retrieved after the app has started " "running. Not supported with `create_server` function" ) - return get_event_loop() + return get_event_loop_policy().get_event_loop() # -------------------------------------------------------------------- # # Registration From 7384047f958ce9b6e6df531f9172429b87ac7ad2 Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Wed, 30 Mar 2022 08:59:06 +0300 Subject: [PATCH 2/2] Remove unused import --- sanic/app.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sanic/app.py b/sanic/app.py index 5e938c6bf1..07de2eb1dc 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -11,7 +11,6 @@ CancelledError, Task, ensure_future, - get_event_loop, get_event_loop_policy, get_running_loop, wait_for,