diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py index 02fb2876a9d942..d9edd50265479b 100644 --- a/Lib/test/test_asyncio/utils.py +++ b/Lib/test/test_asyncio/utils.py @@ -558,7 +558,8 @@ def close_loop(self, loop): else: if isinstance(watcher, asyncio.ThreadedChildWatcher): watcher._join_threads(timeout=support.SHORT_TIMEOUT) - threads = watcher._threads + threads = {key: thread for key, thread in watcher._threads.items() + if thread.is_alive() and not thread.daemon} if threads: self.fail(f"watcher still has running threads: " f"{threads}")