From: Richard Oudkerk Date: Tue, 26 Feb 2013 13:00:15 +0000 (+0000) Subject: Merge X-Git-Tag: v3.3.1rc1~124 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5b8a3242c41a66e4853449bbf52cba667ce4bbe9;p=thirdparty%2FPython%2Fcpython.git Merge --- 5b8a3242c41a66e4853449bbf52cba667ce4bbe9 diff --cc Lib/multiprocessing/forking.py index c5501a2f7533,8dc4b005fc44..0bb21c469d5e --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@@ -102,19 -127,19 +103,24 @@@ if sys.platform != 'win32' code = process_obj._bootstrap() os._exit(code) + # `w` will be closed when the child exits, at which point `r` + # will become ready for reading (using e.g. select()). + os.close(w) + util.Finalize(self, os.close, (r,)) + def poll(self, flag=os.WNOHANG): if self.returncode is None: - 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 + while True: + try: + pid, sts = os.waitpid(self.pid, flag) + except os.error as e: + if e.errno == errno.EINTR: + continue + # Child process not yet created. See #1731717 + # e.errno == errno.ECHILD == 10 + return None + else: + break if pid == self.pid: if os.WIFSIGNALED(sts): self.returncode = -os.WTERMSIG(sts)