Commit 4b7deed9 authored by Brett Cannon's avatar Brett Cannon

Use context manager for a lock.

parent 89dfbe35
...@@ -142,11 +142,8 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin): ...@@ -142,11 +142,8 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin):
if x is None: if x is None:
q.task_done() q.task_done()
return return
self.cumlock.acquire() with self.cumlock:
try:
self.cum += x self.cum += x
finally:
self.cumlock.release()
q.task_done() q.task_done()
def queue_join_test(self, q): def queue_join_test(self, q):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment