From 38a30240c4e21de4c03322cfbf982119094bdf45 Mon Sep 17 00:00:00 2001 From: auxsvr Date: Thu, 7 Dec 2023 15:48:18 +0200 Subject: [PATCH] Use `get_running_loop` instead of `get_event_loop` The latter is deprecated and may not always return the running event loop. --- src/prompt_toolkit/application/application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prompt_toolkit/application/application.py b/src/prompt_toolkit/application/application.py index 726fc0a06..6a8f02906 100644 --- a/src/prompt_toolkit/application/application.py +++ b/src/prompt_toolkit/application/application.py @@ -985,7 +985,7 @@ def _called_from_ipython() -> bool: # See whether a loop was installed already. If so, use that. # That's required for the input hooks to work, they are # installed using `set_event_loop`. - loop = asyncio.get_event_loop() + loop = asyncio.get_running_loop() except RuntimeError: # No loop installed. Run like usual. return asyncio.run(coro)