summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-04-01 21:23:34 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-04-01 21:23:34 (GMT)
commitb4febc79331d2c182221e3172bc8927e95310aa9 (patch)
treef821aaca6ab112bb0223bffaebb1c851aeddb422
parent36e6310e39c23a8082e270a809e3f0851910eec5 (diff)
downloadcpython-b4febc79331d2c182221e3172bc8927e95310aa9.zip
cpython-b4febc79331d2c182221e3172bc8927e95310aa9.tar.gz
cpython-b4febc79331d2c182221e3172bc8927e95310aa9.tar.bz2
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.
-rw-r--r--Lib/test/test_queue.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py
index 06e32ec..8c96194 100644
--- a/Lib/test/test_queue.py
+++ b/Lib/test/test_queue.py
@@ -144,7 +144,7 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin):
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 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin):
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):