Skip to content

[3.15] gh-162616: Clear asyncio's iscoroutine_typecaches between refleak tests (GH-162617) - #162682

Merged
asvetlov merged 1 commit into
python:3.15from
asvetlov:backport-233b95c-3.15
Nov 26, 2026
Merged

asvetlov merged 1 commit into
python:3.15from
asvetlov:backport-233b95c-3.15

Conversation

@asvetlov

Copy link
Copy Markdown
Contributor

(cherry picked from commit 233b95c)

Co-authored-by: Petr Viktorin encukou@gmail.com

🤖 Generated with Claude Code

…een refleak tests (pythonGH-162617)

* pythongh-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>
(cherry picked from commit 233b95c)
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.

2 participants