[Python-3000-checkins] r62093 - python/branches/py3k/Lib/test/test_queue.py

amaury.forgeotdarc python-3000-checkins at python.org
Tue Apr 1 23:23:34 CEST 2008


Author: amaury.forgeotdarc
Date: Tue Apr  1 23:23:34 2008
New Revision: 62093

Modified:
   python/branches/py3k/Lib/test/test_queue.py
Log:
Prevent test_queue from leaking: one worker thread was not stopped.

The version in trunk/ is correct; the problem with 3.0 is that 
None cannot be used as a marker in a PriorityQueue, because it cannot be compared with ints.


Modified: python/branches/py3k/Lib/test/test_queue.py
==============================================================================
--- python/branches/py3k/Lib/test/test_queue.py	(original)
+++ python/branches/py3k/Lib/test/test_queue.py	Tue Apr  1 23:23:34 2008
@@ -144,7 +144,7 @@
     def worker(self, q):
         while True:
             x = q.get()
-            if x is None:
+            if x < 0:
                 q.task_done()
                 return
             with self.cumlock:
@@ -160,7 +160,8 @@
         q.join()
         self.assertEquals(self.cum, sum(range(100)),
                           "q.join() did not block until all tasks were done")
-        q.put(None)         # instruct the threads to close
+        for i in (0,1):
+            q.put(-1)         # instruct the threads to close
         q.join()                # verify that you can join twice
 
     def test_queue_task_done(self):


More information about the Python-3000-checkins mailing list