From: Brett Cannon Date: Sun, 3 Feb 2008 02:43:01 +0000 (+0000) Subject: Use context manager for a lock. X-Git-Tag: v2.6a1~293 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b7deed9a51e34a501f4d9caf1118e16ec2e5e14;p=thirdparty%2FPython%2Fcpython.git Use context manager for a lock. --- diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index 00348a8ad445..fdee1fac3b04 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -142,11 +142,8 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin): 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):