(Merge 3.2) Issue #12096: Fix a race condition in
test_threading.test_waitfor(). Patch written by Charles-François Natali.
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index 3ed61f3..126f97c 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -474,7 +474,7 @@
                 self.assertEqual(state, 4)
         b = Bunch(f, 1)
         b.wait_for_started()
-        for i in range(5):
+        for i in range(4):
             time.sleep(0.01)
             with cond:
                 state += 1
diff --git a/Misc/NEWS b/Misc/NEWS
index b690009..ae98b9b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -679,6 +679,9 @@
 Tests
 -----
 
+- Issue #12096: Fix a race condition in test_threading.test_waitfor(). Patch
+  written by Charles-François Natali.
+
 - Issue #11614: import __hello__ prints "Hello World!". Patch written by
   Andreas Stührk.