From 70de8c5cf4b47425c8c4258c1cba1ad190fb8ce3 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 23 Nov 2024 18:26:19 +0900 Subject: [PATCH] Fix TypeError found in Python 3.12 The following traceback is seen in Pyton 3.12 + Ubuntu Noble. Update the usage to resolve it. ERROR zaqar.common.cli [-] Exception encountered:: TypeError: Passing coroutines is forbidden, use tasks explicitly. ERROR zaqar.common.cli Traceback (most recent call last): ERROR zaqar.common.cli File "/opt/stack/zaqar/zaqar/common/cli.py", line 51, in _wrapper ERROR zaqar.common.cli func() ERROR zaqar.common.cli File "/opt/stack/zaqar/zaqar/cmd/server.py", line 87, in run ERROR zaqar.common.cli server.run() ERROR zaqar.common.cli File "/opt/stack/zaqar/zaqar/bootstrap.py", line 129, in run ERROR zaqar.common.cli self.transport.listen() ERROR zaqar.common.cli File "/opt/stack/zaqar/zaqar/transport/websocket/driver.py", line 102, in listen ERROR zaqar.common.cli loop.run_until_complete(asyncio.wait([coro, task])) ERROR zaqar.common.cli File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete ERROR zaqar.common.cli return future.result() ERROR zaqar.common.cli ^^^^^^^^^^^^^^^ ERROR zaqar.common.cli File "/usr/lib/python3.12/asyncio/tasks.py", line 461, in wait ERROR zaqar.common.cli raise TypeError("Passing coroutines is forbidden, use tasks explicitly.") ERROR zaqar.common.cli TypeError: Passing coroutines is forbidden, use tasks explicitly. ERROR zaqar.common.cli Change-Id: Id1006f715a005dd5ed9789ba0c73d882596d3142 --- zaqar/transport/websocket/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaqar/transport/websocket/driver.py b/zaqar/transport/websocket/driver.py index d9b8edde7..11cb260e9 100644 --- a/zaqar/transport/websocket/driver.py +++ b/zaqar/transport/websocket/driver.py @@ -99,7 +99,7 @@ class Driver(base.DriverBase): task = asyncio.Task(coro_notification) task.add_done_callback(got_server) - loop.run_until_complete(asyncio.wait([coro, task])) + loop.run_until_complete(asyncio.gather(coro, task)) try: loop.run_forever()