gh-162616: Clear asyncio's `iscoroutine_typecache`s between refleak tests (#162617)
* gh-162616: Clear asyncio's `iscoroutine_typecache`s between refleak tests
Creating a task checks if the argument is a coroutine. For non-native
coroutines, this adds the type (the test's `Wrapper`) to `_asyncio`'s
`iscoroutine_typecache`.
Another check adds it to `asyncio.coroutines._iscoroutine_typecache`.
Both caches are capped at 100 entries, so refleak tests report a reference
leak unless you run 100+ warmup runs.
Clear both caches in `libregrtest.utils.clear_caches`.
* Apply suggestions from code review
---------
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
3 files changed