]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
*sigh* did a 'make test' in the wrong window. fixing this up to
authorAnthony Baxter <anthonybaxter@gmail.com>
Tue, 23 Apr 2002 02:19:03 +0000 (02:19 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Tue, 23 Apr 2002 02:19:03 +0000 (02:19 +0000)
not include 'True'. test_queue passes again.

Lib/Queue.py
Lib/test/test_queue.py

index de7be72d7a9d985db61f77cb4d6c91c5711fbdff..fed7a07d23146d8c7e421711e0b4eca9c189c657 100644 (file)
@@ -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:
index c0b94d5926610a22f8663118f36791dca1d2e151..634d8f4e9fba6665826e03df0ab168b35528bdae 100644 (file)
@@ -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")