[Python-checkins] r43287 - python/trunk/Lib/popen2.py
martin.v.loewis
python-checkins at python.org
Fri Mar 24 09:26:27 CET 2006
Author: martin.v.loewis
Date: Fri Mar 24 09:26:26 2006
New Revision: 43287
Modified:
python/trunk/Lib/popen2.py
Log:
Clarify cases when waitpid might not return self.pid.
Modified: python/trunk/Lib/popen2.py
==============================================================================
--- python/trunk/Lib/popen2.py (original)
+++ python/trunk/Lib/popen2.py Fri Mar 24 09:26:26 2006
@@ -94,6 +94,7 @@
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 @@
"""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
More information about the Python-checkins
mailing list