From: Georg Brandl Date: Thu, 25 May 2006 18:44:09 +0000 (+0000) Subject: Guard the _active.remove() call to avoid errors when there is no _active list. X-Git-Tag: v2.5b1~526 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cfecd599b6dbcc7939560e6ca0a74b4223b389e2;p=thirdparty%2FPython%2Fcpython.git Guard the _active.remove() call to avoid errors when there is no _active list. --- diff --git a/Lib/popen2.py b/Lib/popen2.py index 67ebd26dd64e..b966d4c80eb1 100644 --- a/Lib/popen2.py +++ b/Lib/popen2.py @@ -72,8 +72,9 @@ class Popen3: # In case the child hasn't been waited on, check if it's done. self.poll(_deadstate=sys.maxint) if self.sts < 0: - # Child is still running, keep us alive until we can wait on it. - _active.append(self) + if _active: + # Child is still running, keep us alive until we can wait on it. + _active.append(self) def _run_child(self, cmd): if isinstance(cmd, basestring):