Skip to content

gh-162616: Clear asyncio's iscoroutine_typecaches between refleak tests - #162617

Open
encukou wants to merge 1 commit into
python:mainfrom
encukou:clear-iscoroutine_typecaches
Open

encukou wants to merge 1 commit into
python:mainfrom
encukou:clear-iscoroutine_typecaches

Conversation

@encukou

@encukou encukou commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

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.

…leak 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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant