Should there be a Misc/NEWS entry since we are in rc mode?<br><br><div class="gmail_quote">On Tue, Aug 28, 2012 at 2:13 PM, antoine.pitrou <span dir="ltr">&lt;<a href="mailto:python-checkins@python.org" target="_blank">python-checkins@python.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><a href="http://hg.python.org/cpython/rev/454dceb5fd56" target="_blank">http://hg.python.org/cpython/rev/454dceb5fd56</a><br>


changeset:   78790:454dceb5fd56<br>
parent:      78788:06497bbdf4fe<br>
user:        Antoine Pitrou &lt;<a href="mailto:solipsis@pitrou.net">solipsis@pitrou.net</a>&gt;<br>
date:        Tue Aug 28 20:10:18 2012 +0200<br>
summary:<br>
  Issue #15794: Relax a test case due to the deadlock detection&#39;s conservativeness.<br>
<br>
files:<br>
  Lib/test/test_importlib/test_locks.py |  22 ++++++++++++--<br>
  1 files changed, 18 insertions(+), 4 deletions(-)<br>
<br>
<br>
diff --git a/Lib/test/test_importlib/test_locks.py b/Lib/test/test_importlib/test_locks.py<br>
--- a/Lib/test/test_importlib/test_locks.py<br>
+++ b/Lib/test/test_importlib/test_locks.py<br>
@@ -1,4 +1,5 @@<br>
 from importlib import _bootstrap<br>
+import sys<br>
 import time<br>
 import unittest<br>
 import weakref<br>
@@ -41,6 +42,17 @@<br>
 @unittest.skipUnless(threading, &quot;threads needed for this test&quot;)<br>
 class DeadlockAvoidanceTests(unittest.TestCase):<br>
<br>
+    def setUp(self):<br>
+        try:<br>
+            self.old_switchinterval = sys.getswitchinterval()<br>
+            sys.setswitchinterval(0.000001)<br>
+        except AttributeError:<br>
+            self.old_switchinterval = None<br>
+<br>
+    def tearDown(self):<br>
+        if self.old_switchinterval is not None:<br>
+            sys.setswitchinterval(self.old_switchinterval)<br>
+<br>
     def run_deadlock_avoidance_test(self, create_deadlock):<br>
         NLOCKS = 10<br>
         locks = [LockType(str(i)) for i in range(NLOCKS)]<br>
@@ -75,10 +87,12 @@<br>
<br>
     def test_deadlock(self):<br>
         results = self.run_deadlock_avoidance_test(True)<br>
-        # One of the threads detected a potential deadlock on its second<br>
-        # acquire() call.<br>
-        self.assertEqual(results.count((True, False)), 1)<br>
-        self.assertEqual(results.count((True, True)), len(results) - 1)<br>
+        # At least one of the threads detected a potential deadlock on its<br>
+        # second acquire() call.  It may be several of them, because the<br>
+        # deadlock avoidance mechanism is conservative.<br>
+        nb_deadlocks = results.count((True, False))<br>
+        self.assertGreaterEqual(nb_deadlocks, 1)<br>
+        self.assertEqual(results.count((True, True)), len(results) - nb_deadlocks)<br>
<br>
     def test_no_deadlock(self):<br>
         results = self.run_deadlock_avoidance_test(False)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Repository URL: <a href="http://hg.python.org/cpython" target="_blank">http://hg.python.org/cpython</a><br>
</font></span><br>_______________________________________________<br>
Python-checkins mailing list<br>
<a href="mailto:Python-checkins@python.org">Python-checkins@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-checkins" target="_blank">http://mail.python.org/mailman/listinfo/python-checkins</a><br>
<br></blockquote></div><br>