Skip to content

Commit 848ac2e

Browse files
committed
Simplify reap
1 parent 8066645 commit 848ac2e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Lib/socketserver.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class will essentially render the service "deaf" while one request is
128128
import os
129129
import sys
130130
import threading
131-
import contextlib
132131
from io import BufferedIOBase
133132
from time import monotonic as time
134133

@@ -647,11 +646,7 @@ def join(self):
647646
thread.join()
648647

649648
def reap(self):
650-
dead = [thread for thread in self if not thread.is_alive()]
651-
for thread in dead:
652-
# should not happen, but safe to ignore
653-
with contextlib.suppress(ValueError):
654-
self.remove(thread)
649+
self[:] = (thread for thread in self if thread.is_alive())
655650

656651

657652
class _NoThreads:

0 commit comments

Comments
 (0)