From: Guido van Rossum Date: Mon, 9 Apr 2007 00:41:25 +0000 (+0000) Subject: Make sure that a forked child process exits even if it raises an exception. X-Git-Tag: v3.0a1~1082 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62cbc8a2618a41c28b8ec25f70f85f2da17705f2;p=python Make sure that a forked child process exits even if it raises an exception. --- diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 181e32b555..803edd589d 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -735,10 +735,12 @@ class _TestMboxMMDF(TestMailbox): pid = os.fork() if pid == 0: # In the child, lock the mailbox. - self._box.lock() - time.sleep(2) - self._box.unlock() - os._exit(0) + try: + self._box.lock() + time.sleep(2) + self._box.unlock() + finally: + os._exit(0) # In the parent, sleep a bit to give the child time to acquire # the lock.