diff -r ca54c27a9045 Lib/subprocess.py --- a/Lib/subprocess.py Tue Aug 21 14:54:22 2012 +0100 +++ b/Lib/subprocess.py Tue Aug 21 11:44:58 2012 -0700 @@ -1445,9 +1445,15 @@ pid, sts = _waitpid(self.pid, _WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) - except _os_error: + except _os_error as e: if _deadstate is not None: self.returncode = _deadstate + elif e.errno == errno.ECHILD: + # This happens if SIGCLD is set to be ignored or waiting + # for child processes has otherwise been disabled for + # our process. This child is dead, we can't get the + # status. + self.returncode = 0 return self.returncode diff -r ca54c27a9045 Lib/test/subprocessdata/sigchild_ignore.py --- a/Lib/test/subprocessdata/sigchild_ignore.py Tue Aug 21 14:54:22 2012 +0100 +++ b/Lib/test/subprocessdata/sigchild_ignore.py Tue Aug 21 11:44:58 2012 -0700 @@ -4,3 +4,8 @@ # and causing us to exit with an error is what we are testing against. signal.signal(signal.SIGCHLD, signal.SIG_IGN) subprocess.Popen([sys.executable, '-c', 'print("albatross")']).wait() +# Also ensure poll() handles the errno.ECHILD appropriately. +p = subprocess.Popen([sys.executable, '-c', 'print("albatross")']) +while p.poll() is None: + # Waiting for the process to finish. + pass