[3.9] bpo-45097: Remove incorrect deprecation warnings in asyncio. (GH-28153)

Deprecation warnings about the loop argument were incorrectly emitted
in cases when the loop argument was used inside the asyncio library,
not from user code.
This commit is contained in:
Serhiy Storchaka 2021-09-04 20:54:50 +03:00 committed by GitHub
parent ce83e42437
commit c967bd523c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 234 additions and 181 deletions

View file

@ -301,11 +301,12 @@ async def producer(queue, num_items):
with self.assertWarns(DeprecationWarning):
q = asyncio.Queue(queue_size, loop=self.loop)
self.loop.run_until_complete(
asyncio.gather(producer(q, producer_num_items),
consumer(q, producer_num_items),
loop=self.loop),
)
with self.assertWarns(DeprecationWarning):
self.loop.run_until_complete(
asyncio.gather(producer(q, producer_num_items),
consumer(q, producer_num_items),
loop=self.loop),
)
def test_cancelled_getters_not_being_held_in_self_getters(self):
def a_generator():
@ -555,8 +556,9 @@ async def getter():
t1 = putter(1)
t2 = putter(2)
t3 = putter(3)
self.loop.run_until_complete(
asyncio.gather(getter(), t0, t1, t2, t3, loop=self.loop))
with self.assertWarns(DeprecationWarning):
self.loop.run_until_complete(
asyncio.gather(getter(), t0, t1, t2, t3, loop=self.loop))
def test_cancelled_puts_not_being_held_in_self_putters(self):
def a_generator():