Skip to content

Commit 7264e92

Browse files
asvetlovmiss-islington
authored andcommitted
1 parent efd5741 commit 7264e92

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

Lib/asyncio/locks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def __init__(self, lock=None, *, loop=None):
332332
DeprecationWarning, stacklevel=2)
333333

334334
if lock is None:
335-
lock = Lock(loop=self._loop)
335+
lock = Lock(loop=loop)
336336
elif lock._loop is not self._loop:
337337
raise ValueError("loop argument must agree with lock")
338338

Lib/asyncio/queues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, maxsize=0, *, loop=None):
4545
# Futures.
4646
self._putters = collections.deque()
4747
self._unfinished_tasks = 0
48-
self._finished = locks.Event(loop=self._loop)
48+
self._finished = locks.Event(loop=loop)
4949
self._finished.set()
5050
self._init(maxsize)
5151

Lib/test/test_asyncio/test_locks.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,9 @@ def test_ctor_loop(self):
500500
self.assertIs(cond._loop, self.loop)
501501

502502
def test_ctor_noloop(self):
503-
with self.assertWarns(DeprecationWarning):
504-
asyncio.set_event_loop(self.loop)
505-
cond = asyncio.Condition()
506-
self.assertIs(cond._loop, self.loop)
503+
asyncio.set_event_loop(self.loop)
504+
cond = asyncio.Condition()
505+
self.assertIs(cond._loop, self.loop)
507506

508507
def test_wait(self):
509508
with self.assertWarns(DeprecationWarning):

Lib/test/test_asyncio/test_queues.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ def test_ctor_loop(self):
8383

8484
def test_ctor_noloop(self):
8585
asyncio.set_event_loop(self.loop)
86-
with self.assertWarns(DeprecationWarning):
87-
q = asyncio.Queue()
86+
q = asyncio.Queue()
8887
self.assertIs(q._loop, self.loop)
8988

9089
def test_repr(self):

Lib/unittest/async_case.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ def _callMaybeAsync(self, func, /, *args, **kwargs):
8989
else:
9090
return ret
9191

92-
async def _asyncioLoopRunner(self):
93-
queue = self._asyncioCallsQueue
92+
async def _asyncioLoopRunner(self, fut):
93+
self._asyncioCallsQueue = queue = asyncio.Queue()
94+
fut.set_result(None)
9495
while True:
9596
query = await queue.get()
9697
queue.task_done()
@@ -113,8 +114,9 @@ def _setupAsyncioLoop(self):
113114
asyncio.set_event_loop(loop)
114115
loop.set_debug(True)
115116
self._asyncioTestLoop = loop
116-
self._asyncioCallsQueue = asyncio.Queue(loop=loop)
117-
self._asyncioCallsTask = loop.create_task(self._asyncioLoopRunner())
117+
fut = loop.create_future()
118+
self._asyncioCallsTask = loop.create_task(self._asyncioLoopRunner(fut))
119+
loop.run_until_complete(fut)
118120

119121
def _tearDownAsyncioLoop(self):
120122
assert self._asyncioTestLoop is not None

0 commit comments

Comments
 (0)