[Python-checkins] r60539 - python/trunk/Lib/test/test_queue.py

brett.cannon python-checkins at python.org
Sun Feb 3 03:43:02 CET 2008


Author: brett.cannon
Date: Sun Feb  3 03:43:01 2008
New Revision: 60539

Modified:
   python/trunk/Lib/test/test_queue.py
Log:
Use context manager for a lock.


Modified: python/trunk/Lib/test/test_queue.py
==============================================================================
--- python/trunk/Lib/test/test_queue.py	(original)
+++ python/trunk/Lib/test/test_queue.py	Sun Feb  3 03:43:01 2008
@@ -142,11 +142,8 @@
             if x is None:
                 q.task_done()
                 return
-            self.cumlock.acquire()
-            try:
+            with self.cumlock:
                 self.cum += x
-            finally:
-                self.cumlock.release()
             q.task_done()
 
     def queue_join_test(self, q):


More information about the Python-checkins mailing list