GH-96764: rewrite asyncio.wait_for to use asyncio.timeout (#98518)

Changes `asyncio.wait_for` to use `asyncio.timeout` as its underlying implementation.
This commit is contained in:
Kumar Aditya 2023-02-17 00:18:21 +05:30 committed by GitHub
parent 226484e475
commit a5024a261a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 133 additions and 79 deletions

View file

@ -86,10 +86,9 @@ class FutureReprTests(unittest.IsolatedAsyncioTestCase):
async def func():
return asyncio.all_tasks()
# The repr() call should not raise RecursiveError at first.
# The check for returned string is not very reliable but
# exact comparison for the whole string is even weaker.
self.assertIn('...', repr(await asyncio.wait_for(func(), timeout=10)))
# The repr() call should not raise RecursionError at first.
waiter = await asyncio.wait_for(asyncio.Task(func()),timeout=10)
self.assertIn('...', repr(waiter))
if __name__ == '__main__':