[Python-checkins] r78777 - python/trunk/Lib/multiprocessing/forking.py

florent.xicluna python-checkins at python.org
Mon Mar 8 00:49:04 CET 2010


Author: florent.xicluna
Date: Mon Mar  8 00:49:03 2010
New Revision: 78777

Log:
Backport the Popen.poll() protection from subprocess to multiprocessing. See #1731717.
It should fix transient failures on test_multiprocessing.



Modified:
   python/trunk/Lib/multiprocessing/forking.py

Modified: python/trunk/Lib/multiprocessing/forking.py
==============================================================================
--- python/trunk/Lib/multiprocessing/forking.py	(original)
+++ python/trunk/Lib/multiprocessing/forking.py	Mon Mar  8 00:49:03 2010
@@ -103,7 +103,12 @@
 
         def poll(self, flag=os.WNOHANG):
             if self.returncode is None:
-                pid, sts = os.waitpid(self.pid, flag)
+                try:
+                    pid, sts = os.waitpid(self.pid, flag)
+                except os.error:
+                    # Child process not yet created. See #1731717
+                    # e.errno == errno.ECHILD == 10
+                    return None
                 if pid == self.pid:
                     if os.WIFSIGNALED(sts):
                         self.returncode = -os.WTERMSIG(sts)


More information about the Python-checkins mailing list