diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-03-24 08:26:26 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-03-24 08:26:26 (GMT) |
commit | b95caff56c6bc0b5411eb66de155bf920915e9ff (patch) | |
tree | 4a38286431d4c70c83608559037d896c29f97352 /Lib/popen2.py | |
parent | 478c82d30f0568cf3b418819d4189c8a072e589d (diff) | |
download | cpython-b95caff56c6bc0b5411eb66de155bf920915e9ff.zip cpython-b95caff56c6bc0b5411eb66de155bf920915e9ff.tar.gz cpython-b95caff56c6bc0b5411eb66de155bf920915e9ff.tar.bz2 |
Clarify cases when waitpid might not return self.pid.
Diffstat (limited to 'Lib/popen2.py')
-rw-r--r-- | Lib/popen2.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/popen2.py b/Lib/popen2.py index 1529f7e..67ebd26 100644 --- a/Lib/popen2.py +++ b/Lib/popen2.py @@ -94,6 +94,7 @@ class Popen3: if self.sts < 0: try: pid, sts = os.waitpid(self.pid, os.WNOHANG) + # pid will be 0 if self.pid hasn't terminated if pid == self.pid: self.sts = sts except os.error: @@ -105,8 +106,10 @@ class Popen3: """Wait for and return the exit status of the child process.""" if self.sts < 0: pid, sts = os.waitpid(self.pid, 0) - if pid == self.pid: - self.sts = sts + # This used to be a test, but it is believed to be + # always true, so I changed it to an assertion - mvl + assert pid == self.pid + self.sts = sts return self.sts |