aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2025-04-30 15:14:24 +0200
committerGitHub <noreply@github.com>2025-04-30 15:14:24 +0200
commit8b26b23a9674a02563f28e4cfbef3d3e39876bfe (patch)
tree290a86e537c21dfbde0478eced70007b881e332c /Lib/test/test_threading.py
parent5154d412a45a918ea7e3876f5a9001d6d8460787 (diff)
downloadcpython-8b26b23a9674a02563f28e4cfbef3d3e39876bfe.tar.gz
cpython-8b26b23a9674a02563f28e4cfbef3d3e39876bfe.zip
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 4ebbfcf30e0e2d87ff6036d4d1de0f6f0ef7c46a
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index b7688863626..814c00ca0fd 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -1219,18 +1219,18 @@ class ThreadTests(BaseTestCase):
import threading
done = threading.Event()
- def loop():
+ def set_event():
done.set()
-
class Cycle:
def __init__(self):
self.self_ref = self
- self.thr = threading.Thread(target=loop, daemon=True)
+ self.thr = threading.Thread(target=set_event, daemon=True)
self.thr.start()
- done.wait()
+ self.thr.join()
def __del__(self):
+ assert done.is_set()
assert not self.thr.is_alive()
self.thr.join()
assert not self.thr.is_alive()