From: Anthony Baxter Date: Tue, 23 Apr 2002 02:19:03 +0000 (+0000) Subject: *sigh* did a 'make test' in the wrong window. fixing this up to X-Git-Tag: 2.1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=047fa8194d67ddeda4177215632517543748ec48;p=thirdparty%2FPython%2Fcpython.git *sigh* did a 'make test' in the wrong window. fixing this up to not include 'True'. test_queue passes again. --- diff --git a/Lib/Queue.py b/Lib/Queue.py index de7be72d7a9d..fed7a07d2314 100644 --- a/Lib/Queue.py +++ b/Lib/Queue.py @@ -55,7 +55,7 @@ class Queue: elif not self.fsema.acquire(0): raise Full self.mutex.acquire() - release_fsema = True + release_fsema = 1 try: was_empty = self._empty() self._put(item) @@ -64,7 +64,7 @@ class Queue: if was_empty: self.esema.release() # If we fail before here, the queue can not be full, so - # release_full_sema remains True + # release_full_sema remains true release_fsema = not self._full() finally: # Catching system level exceptions here (RecursionDepth, @@ -95,7 +95,7 @@ class Queue: elif not self.esema.acquire(0): raise Empty self.mutex.acquire() - release_esema = True + release_esema = 1 try: was_full = self._full() item = self._get() @@ -104,7 +104,7 @@ class Queue: if was_full: self.fsema.release() # Failure means empty state also unchanged - release_esema - # remains True. + # remains true. release_esema = not self._empty() finally: if release_esema: diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index c0b94d592661..634d8f4e9fba 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -41,17 +41,17 @@ class FailingQueueException(Exception): class FailingQueue(Queue.Queue): def __init__(self, *args): - self.fail_next_put = False - self.fail_next_get = False + self.fail_next_put = 0 + self.fail_next_get = 0 Queue.Queue.__init__(self, *args) def _put(self, item): if self.fail_next_put: - self.fail_next_put = False + self.fail_next_put = 0 raise FailingQueueException, "You Lose" return Queue.Queue._put(self, item) def _get(self): if self.fail_next_get: - self.fail_next_get = False + self.fail_next_get = 0 raise FailingQueueException, "You Lose" return Queue.Queue._get(self) @@ -60,7 +60,7 @@ def FailingQueueTest(q): raise RuntimeError, "Call this function with an empty queue" for i in range(queue_size-1): q.put(i) - q.fail_next_put = True + q.fail_next_put = 1 # Test a failing non-blocking put. try: q.put("oops", block=0) @@ -69,7 +69,7 @@ def FailingQueueTest(q): pass q.put("last") verify(q.full(), "Queue should be full") - q.fail_next_put = True + q.fail_next_put = 1 # Test a failing blocking put try: _doBlockingTest( q.put, ("full",), q.get, ()) @@ -91,7 +91,7 @@ def FailingQueueTest(q): q.get() verify(q.empty(), "Queue should be empty") q.put("first") - q.fail_next_get = True + q.fail_next_get = 1 try: q.get() raise TestFailed("The queue didn't fail when it should have") @@ -100,7 +100,7 @@ def FailingQueueTest(q): verify(not q.empty(), "Queue should not be empty") q.get() verify(q.empty(), "Queue should be empty") - q.fail_next_get = True + q.fail_next_get = 1 try: _doBlockingTest( q.get, (), q.put, ('empty',)) raise TestFailed("The queue didn't fail when it should have")