[Python-Dev] FW: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32

Kevin Jacobs <jacobs@bioinformed.com> bioinformed at gmail.com
Fri Jul 21 18:43:44 CEST 2006


On 7/21/06, Nick Coghlan <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.

Thanks again,
-Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060721/f57de211/attachment.html 


More information about the Python-Dev mailing list