diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-02-03 02:43:01 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-02-03 02:43:01 (GMT) |
commit | 4b7deed9a51e34a501f4d9caf1118e16ec2e5e14 (patch) | |
tree | ba0eaf3129bf70a3463417cbdde2afd3c5cf4bc1 /Lib/test/test_queue.py | |
parent | 89dfbe35af6379a041f52bc97ce1ad5638257098 (diff) | |
download | cpython-4b7deed9a51e34a501f4d9caf1118e16ec2e5e14.zip cpython-4b7deed9a51e34a501f4d9caf1118e16ec2e5e14.tar.gz cpython-4b7deed9a51e34a501f4d9caf1118e16ec2e5e14.tar.bz2 |
Use context manager for a lock.
Diffstat (limited to 'Lib/test/test_queue.py')
-rw-r--r-- | Lib/test/test_queue.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index 00348a8..fdee1fa 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): |