Skip to content

Commit 145e787

Browse files
committed
Use try/finally to set stopped
1 parent 9c26277 commit 145e787

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

test/asynchronous/helpers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,5 +403,7 @@ def is_alive(self):
403403
return not self.stopped
404404

405405
async def run(self):
406-
await self.target(*self.args)
407-
self.stopped = True
406+
try:
407+
await self.target(*self.args)
408+
finally:
409+
self.stopped = True

test/helpers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,5 +403,7 @@ def is_alive(self):
403403
return not self.stopped
404404

405405
def run(self):
406-
self.target(*self.args)
407-
self.stopped = True
406+
try:
407+
self.target(*self.args)
408+
finally:
409+
self.stopped = True

0 commit comments

Comments
 (0)