[issue19021] AttributeError in Popen.__del__

Richard Oudkerk report at bugs.python.org
Thu Oct 3 16:15:20 CEST 2013


Richard Oudkerk added the comment:

> Well, perhaps we can special-case builtins not to be "wiped" at shutdown.
> However, there is another problem here in that the Popen object survives 
> until the builtins module is wiped. This should be investigated too.

Maybe it is because it uses the evil resuscitate-in-__del__ trick.  I 
presume that if the child process survives during shutdown, then the popen 
object is guaranteed to survive too.

We could get rid of the trick:

* On Windows __del__ is unneeded since we don't need to reap zombie 
  processes.

* On Unix __del__ could just add self._pid (rather than self) to the list 
  _active.  _cleanup() would then use os.waitpid() to check the pids in 
  _active.

The hardest thing about making such a change is that test_subprocess 
currently uses _active.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19021>
_______________________________________


More information about the Python-bugs-list mailing list