forked from pool/python-aiohttp
60 lines
1.7 KiB
Diff
60 lines
1.7 KiB
Diff
|
From dd3a89130b5769218550159ebbab9e28d8b974a3 Mon Sep 17 00:00:00 2001
|
||
|
From: Hanaasagi <ambiguous404@gmail.com>
|
||
|
Date: Tue, 3 Aug 2021 11:53:45 +0000
|
||
|
Subject: [PATCH] fix: remove deprecated loop argument for asnycio.sleep/gather
|
||
|
calls
|
||
|
|
||
|
---
|
||
|
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
|
||
|
|
||
|
--- /dev/null
|
||
|
+++ b/CHANGES/5905.bugfix
|
||
|
@@ -0,0 +1 @@
|
||
|
+remove deprecated loop argument for asnycio.sleep/gather calls
|
||
|
--- a/aiohttp/web.py
|
||
|
+++ b/aiohttp/web.py
|
||
|
@@ -440,9 +440,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():
|
||
|
--- a/tests/test_locks.py
|
||
|
+++ b/tests/test_locks.py
|
||
|
@@ -18,7 +18,7 @@ class TestEventResultOrError:
|
||
|
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 @@ class TestEventResultOrError:
|
||
|
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 @@ class TestEventResultOrError:
|
||
|
|
||
|
t1 = loop.create_task(c())
|
||
|
t2 = loop.create_task(c())
|
||
|
- await asyncio.sleep(0, loop=loop)
|
||
|
+ await asyncio.sleep(0)
|
||
|
ev.cancel()
|
||
|
ev.set()
|
||
|
|