gh-126353: remove implicit creation of loop from asyncio.get_event_loop (#126354)

Remove implicit creation of loop from `asyncio.get_event_loop`. This is a step forward of deprecating the policy system of asyncio.
This commit is contained in:
Kumar Aditya 2024-11-04 14:21:20 +05:30 committed by GitHub
parent 0d80777981
commit fe5a6ab7be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 24 additions and 62 deletions

View file

@ -1195,8 +1195,7 @@ class TestFork(unittest.IsolatedAsyncioTestCase):
if pid == 0:
# child
try:
with self.assertWarns(DeprecationWarning):
loop = asyncio.get_event_loop_policy().get_event_loop()
loop = asyncio.get_event_loop()
os.write(w, b'LOOP:' + str(id(loop)).encode())
except RuntimeError:
os.write(w, b'NO LOOP')
@ -1207,8 +1206,7 @@ class TestFork(unittest.IsolatedAsyncioTestCase):
else:
# parent
result = os.read(r, 100)
self.assertEqual(result[:5], b'LOOP:', result)
self.assertNotEqual(int(result[5:]), id(loop))
self.assertEqual(result, b'NO LOOP')
wait_process(pid, exitcode=0)
@hashlib_helper.requires_hashdigest('md5')