From ec7b789b22e3267d4a0eb24164c8aded9f7badf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 27 Jan 2023 05:25:47 +0100 Subject: [PATCH] Do not call asyncio.get_event_loop() before creating one The implicit creation of new loop was removed in Python 3.11. In fact, this code can be greatly simplified with asyncio.run(). QubesOS/qubes-issues#6982 (cherry picked from commit 40f963b36530469cb95bda35e8421a56b58439d0) --- qrexec/tools/qrexec_policy_agent.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/qrexec/tools/qrexec_policy_agent.py b/qrexec/tools/qrexec_policy_agent.py index 2beecd3b..97e9b44e 100644 --- a/qrexec/tools/qrexec_policy_agent.py +++ b/qrexec/tools/qrexec_policy_agent.py @@ -648,11 +648,7 @@ def main(): gbulb.install() agent = PolicyAgent(args.socket_path) - loop = asyncio.get_event_loop() - tasks = [ - asyncio.create_task(agent.run()), - ] - loop.run_until_complete(asyncio.wait(tasks)) + asyncio.run(agent.run()), if __name__ == "__main__":