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
This commit is contained in:
Takashi Kajinami 2024-11-23 18:26:19 +09:00
parent 59ec329624
commit 70de8c5cf4

View File

@ -99,7 +99,7 @@ class Driver(base.DriverBase):
task = asyncio.Task(coro_notification) task = asyncio.Task(coro_notification)
task.add_done_callback(got_server) task.add_done_callback(got_server)
loop.run_until_complete(asyncio.wait([coro, task])) loop.run_until_complete(asyncio.gather(coro, task))
try: try:
loop.run_forever() loop.run_forever()