From 4b7deed9a51e34a501f4d9caf1118e16ec2e5e14 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sun, 3 Feb 2008 02:43:01 +0000 Subject: [PATCH] Use context manager for a lock. --- Lib/test/test_queue.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index 00348a8ad4..fdee1fac3b 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): -- 2.50.1