mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
Backport the Popen.poll() protection from subprocess to multiprocessing. See #1731717.
It should fix transient failures on test_multiprocessing.
This commit is contained in:
parent
08611b5e55
commit
16cd888dd9
1 changed files with 6 additions and 1 deletions
|
@ -103,7 +103,12 @@ if sys.platform != 'win32':
|
||||||
|
|
||||||
def poll(self, flag=os.WNOHANG):
|
def poll(self, flag=os.WNOHANG):
|
||||||
if self.returncode is None:
|
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 pid == self.pid:
|
||||||
if os.WIFSIGNALED(sts):
|
if os.WIFSIGNALED(sts):
|
||||||
self.returncode = -os.WTERMSIG(sts)
|
self.returncode = -os.WTERMSIG(sts)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue