Skip to content

Commit 8b26b23

Browse files
authored
gh-87135: test_threading: Wait on thread, not an Event it sets (GH-133198)
When the event is set the thread might not be done yet. This is a fix-up for commit 4ebbfcf
1 parent 5154d41 commit 8b26b23

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/test/test_threading.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,18 +1219,18 @@ def test_join_finished_daemon_thread_in_finalization(self):
12191219
import threading
12201220
done = threading.Event()
12211221
1222-
def loop():
1222+
def set_event():
12231223
done.set()
12241224
1225-
12261225
class Cycle:
12271226
def __init__(self):
12281227
self.self_ref = self
1229-
self.thr = threading.Thread(target=loop, daemon=True)
1228+
self.thr = threading.Thread(target=set_event, daemon=True)
12301229
self.thr.start()
1231-
done.wait()
1230+
self.thr.join()
12321231
12331232
def __del__(self):
1233+
assert done.is_set()
12341234
assert not self.thr.is_alive()
12351235
self.thr.join()
12361236
assert not self.thr.is_alive()

0 commit comments

Comments
 (0)