diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py index 16c4e1eb343736..11c8fca360fa22 100644 --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -156,10 +156,16 @@ def is_alive(self): if self is _current_process: return True assert self._parent_pid == os.getpid(), 'can only test a child process' + if self._popen is None: return False - self._popen.poll() - return self._popen.returncode is None + + returncode = self._popen.poll() + if returncode is None: + return True + else: + _current_process._children.discard(self) + return False @property def name(self):