From: Florent Xicluna Date: Sun, 7 Mar 2010 23:49:03 +0000 (+0000) Subject: Backport the Popen.poll() protection from subprocess to multiprocessing. See #1731717. X-Git-Tag: v2.7b1~421 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16cd888dd9fa4dc2da642a8edb45e708e296a086;p=python Backport the Popen.poll() protection from subprocess to multiprocessing. See #1731717. It should fix transient failures on test_multiprocessing. --- diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index 7eda99180a..a66f7a0889 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -103,7 +103,12 @@ if sys.platform != 'win32': 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)