[Python-3000-checkins] r54718 - python/branches/p3yk/Lib/test/test_mailbox.py

guido.van.rossum python-3000-checkins at python.org
Mon Apr 9 02:41:29 CEST 2007


Author: guido.van.rossum
Date: Mon Apr  9 02:41:25 2007
New Revision: 54718

Modified:
   python/branches/p3yk/Lib/test/test_mailbox.py
Log:
Make sure that a forked child process exits even if it raises an exception.


Modified: python/branches/p3yk/Lib/test/test_mailbox.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_mailbox.py	(original)
+++ python/branches/p3yk/Lib/test/test_mailbox.py	Mon Apr  9 02:41:25 2007
@@ -735,10 +735,12 @@
         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.


More information about the Python-3000-checkins mailing list