Commit c90621c7 authored by Denis Bilenko's avatar Denis Bilenko

subprocess: remove useless code

parent bd77ef3b
...@@ -367,20 +367,13 @@ class Popen(object): ...@@ -367,20 +367,13 @@ class Popen(object):
self.pid = pid self.pid = pid
ht.Close() ht.Close()
def _internal_poll(self, _deadstate=None, def _internal_poll(self):
_WaitForSingleObject=_subprocess.WaitForSingleObject,
_WAIT_OBJECT_0=_subprocess.WAIT_OBJECT_0,
_GetExitCodeProcess=_subprocess.GetExitCodeProcess):
"""Check if child process has terminated. Returns returncode """Check if child process has terminated. Returns returncode
attribute. attribute.
This method is called by __del__, so it can only refer to objects
in its local scope.
""" """
if self.returncode is None: if self.returncode is None:
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0: if _subprocess.WaitForSingleObject(self._handle, 0) == _subprocess._WAIT_OBJECT_0:
self.returncode = _GetExitCodeProcess(self._handle) self.returncode = _subprocess.GetExitCodeProcess(self._handle)
return self.returncode return self.returncode
...@@ -623,15 +616,11 @@ class Popen(object): ...@@ -623,15 +616,11 @@ class Popen(object):
raise child_exception raise child_exception
def _handle_exitstatus(self, sts, _WIFSIGNALED=os.WIFSIGNALED, def _handle_exitstatus(self, sts):
_WTERMSIG=os.WTERMSIG, _WIFEXITED=os.WIFEXITED, if os.WIFSIGNALED(sts):
_WEXITSTATUS=os.WEXITSTATUS): self.returncode = -os.WTERMSIG(sts)
# This method is called (indirectly) by __del__, so it cannot elif os.WIFEXITED(sts):
# refer to anything outside of its local scope.""" self.returncode = os.WEXITSTATUS(sts)
if _WIFSIGNALED(sts):
self.returncode = -_WTERMSIG(sts)
elif _WIFEXITED(sts):
self.returncode = _WEXITSTATUS(sts)
else: else:
# Should never happen # Should never happen
raise RuntimeError("Unknown child exit status!") raise RuntimeError("Unknown child exit status!")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment