From 74114a62d05d1eda0ec442ec352736a90af3ba98 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 23 Jan 2023 13:27:02 -0500 Subject: [PATCH] MNT: Avoid warning on 3.10.9+, 3.11.1+, and 3.12.0+ closes #1696 --- src/prompt_toolkit/eventloop/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/prompt_toolkit/eventloop/utils.py b/src/prompt_toolkit/eventloop/utils.py index 2e5a05e83..26dabb40e 100644 --- a/src/prompt_toolkit/eventloop/utils.py +++ b/src/prompt_toolkit/eventloop/utils.py @@ -115,4 +115,6 @@ def get_event_loop() -> asyncio.AbstractEventLoop: try: return getloop() except RuntimeError: - return asyncio.get_event_loop_policy().get_event_loop() + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + return loop