[Python-Dev] FW: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32
Georg Brandl
g.brandl at gmx.net
Fri Jul 21 19:39:40 CEST 2006
Kevin Jacobs <jacobs at bioinformed.com> wrote:
> On 7/21/06, *Nick Coghlan* <ncoghlan at gmail.com
> <mailto:ncoghlan at gmail.com>> wrote:
>
> Delaney, Timothy (Tim) wrote:
> > Looks like there's a bug in Popen.__del__ in 2.5. I'm not in a
> position
> > to have a look right now.
>
> For those not watching python-checkins, a check for "is not None"
> has been
> added before the offending line in Popen.__del__. (by Georg, IIRC)
>
>
> Many thanks for accepting my patch. There remains a potentially related
> problem in popen2.py, but it may be a lower priority, since most folks
> should be using subprocess.
>
> def __del__(self):
> # In case the child hasn't been waited on, check if it's done.
> self.poll(_deadstate=sys.maxint)
> if self.sts < 0:
> if _active:
> # Child is still running, keep us alive until we can
> wait on it.
> _active.append(self)
>
>
> The is _active check, unless it intendeds to check for either empty or
> None, should probably be revised to:
>
> def __del__(self):
> # In case the child hasn't been waited on, check if it's done.
> self.poll(_deadstate=sys.maxint)
> if self.sts < 0:
> if _active is None:
> # Child is still running, keep us alive until we can
> wait on it.
> _active.append(self)
>
> However, there may be a clever reason for doing what is doing that I do
> not see.
There's no reason (I know since I added the check myself ;). Thanks
for pointing out that obvious bug. (fixed in rev 50759).
Georg
More information about the Python-Dev
mailing list