Skip to content

Commit 85b79b2

Browse files
committed
Fix code to clear references to terminated threads
1 parent dbbad2d commit 85b79b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/asyncio/unix_events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,8 +1381,8 @@ def _join_threads(self, timeout=None):
13811381
thread.join(timeout)
13821382

13831383
# Clear references to terminated threads
1384-
self._threads[:] = [thread for thread in list(self._threads.values())
1385-
if thread.is_alive() and not thread.daemon]
1384+
self._threads = {key: thread for key, thread in self._threads.items()
1385+
if thread.daemon or thread.is_alive()}
13861386

13871387
def __enter__(self):
13881388
return self

0 commit comments

Comments
 (0)