From ee68bf4631b880b609d232393dcb40ba0acff6c0 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:56:54 +0000 Subject: [PATCH] fix: remove deprecated loop argument for asnycio.sleep/gather calls (#5928) (#5929) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit a341986d9e4f577bc879ad4f45a77aaf08ced4f6) Co-authored-by: 秋葉 --- CHANGES/5905.bugfix | 1 + aiohttp/web.py | 4 +--- tests/test_locks.py | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 CHANGES/5905.bugfix diff --git a/CHANGES/5905.bugfix b/CHANGES/5905.bugfix new file mode 100644 index 00000000000..b667968fe19 --- /dev/null +++ b/CHANGES/5905.bugfix @@ -0,0 +1 @@ +remove deprecated loop argument for asnycio.sleep/gather calls diff --git a/aiohttp/web.py b/aiohttp/web.py index b20957e485c..d4e20213d3c 100644 --- a/aiohttp/web.py +++ b/aiohttp/web.py @@ -442,9 +442,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(): diff --git a/tests/test_locks.py b/tests/test_locks.py index 55fd2330ec4..5f434eace97 100644 --- a/tests/test_locks.py +++ b/tests/test_locks.py @@ -18,7 +18,7 @@ async def c(): 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 @@ -31,7 +31,7 @@ async def c(): return 1 t = loop.create_task(c()) - await asyncio.sleep(0, loop=loop) + await asyncio.sleep(0) ev.set() assert (await t) == 1 @@ -43,7 +43,7 @@ async def c(): t1 = loop.create_task(c()) t2 = loop.create_task(c()) - await asyncio.sleep(0, loop=loop) + await asyncio.sleep(0) ev.cancel() ev.set()