Skip to content

Commit

Permalink
Do not call asyncio.get_event_loop() before creating one
Browse files Browse the repository at this point in the history
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 40f963b)
  • Loading branch information
marmarek committed May 12, 2023
1 parent 7447e2c commit 6443f45
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions qrexec/tools/qrexec_policy_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down

0 comments on commit 6443f45

Please sign in to comment.