Skip to content

Commit

Permalink
tests: get (almost) everything passing again by removing explicit "lo…
Browse files Browse the repository at this point in the history
…op" kwarg

In several parts of asyncio, explicit "loop" kwarg was deprecated in 3.8
and removed in 3.10. These interfaces have automatically used the
correct loop since 3.7, so by dropping 3.6 support, no problem remains.
  • Loading branch information
alanbriolat committed Feb 14, 2022
1 parent 745781a commit f317ce5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/csbot/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ def _run(self):
new_pending.cancel()
break
# Run until 1 or more tasks complete (or more tasks are added)
done, not_done = yield from asyncio.wait(not_done,
return_when=asyncio.FIRST_COMPLETED)
done, not_done = await asyncio.wait(not_done, return_when=asyncio.FIRST_COMPLETED)
# Handle exceptions raised by tasks
for f in done:
e = f.exception()
Expand Down Expand Up @@ -238,10 +237,7 @@ def _run_handler(self, handler, event):
result = handler(event)
except Exception as e:
self._handle_exception(exception=e, csbot_event=event)
future = maybe_future(
result,
log=LOG,
)
future = maybe_future(result, log=LOG)
if future:
future = asyncio.ensure_future(self._finish_async_handler(future, event), loop=self.loop)
return future
Expand Down Expand Up @@ -275,8 +271,7 @@ async def _run(self):
# Run until one or more futures complete (or new events are added)
new_events = self.loop.create_task(self.new_events.wait())
LOG.debug('waiting on %s futures', len(self.futures))
done, pending = await asyncio.wait(self.futures | {new_events},
return_when=asyncio.FIRST_COMPLETED)
done, pending = await asyncio.wait(self.futures | {new_events}, return_when=asyncio.FIRST_COMPLETED)
# Remove done futures from the set of futures being waited on
done_futures = done - {new_events}
LOG.debug('%s of %s futures done', len(done_futures), len(self.futures))
Expand Down

0 comments on commit f317ce5

Please sign in to comment.