Skip to content

Commit

Permalink
fix: remove deprecated loop argument for asnycio.sleep/gather calls (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanaasagi committed Aug 3, 2021
1 parent 33a38b8 commit a341986
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES/5905.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
remove deprecated loop argument for asnycio.sleep/gather calls
4 changes: 1 addition & 3 deletions aiohttp/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,7 @@ def _cancel_tasks(
for task in to_cancel:
task.cancel()

loop.run_until_complete(
asyncio.gather(*to_cancel, loop=loop, return_exceptions=True)
)
loop.run_until_complete(asyncio.gather(*to_cancel, return_exceptions=True))

for task in to_cancel:
if task.cancelled():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async def test_del_with_scheduled_cleanup(loop: Any) -> None:
# obviously doesn't deletion because loop has a strong
# reference to connector's instance method, isn't it?
del conn
await asyncio.sleep(0.01, loop=loop)
await asyncio.sleep(0.01)
gc.collect()

assert not conns_impl
Expand Down
6 changes: 3 additions & 3 deletions tests/test_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def c() -> Union[int, Exception]:
return 1

t = loop.create_task(c())
await asyncio.sleep(0, loop=loop)
await asyncio.sleep(0)
e = Exception()
ev.set(exc=e)
assert (await t) == e
Expand All @@ -32,7 +32,7 @@ async def c() -> int:
return 1

t = loop.create_task(c())
await asyncio.sleep(0, loop=loop)
await asyncio.sleep(0)
ev.set()
assert (await t) == 1

Expand All @@ -44,7 +44,7 @@ async def c() -> None:

t1 = loop.create_task(c())
t2 = loop.create_task(c())
await asyncio.sleep(0, loop=loop)
await asyncio.sleep(0)
ev.cancel()
ev.set()

Expand Down

0 comments on commit a341986

Please sign in to comment.