[issue12085] subprocess.Popen.__del__ raises AttributeError if __init__ was called with an invalid argument list

R. David Murray report at bugs.python.org
Sun Sep 22 00:27:17 CEST 2013


R. David Murray added the comment:

__del__ methods are in general tricky because they are in the general case run asynchronously.  Therefore any proposal to "attach" the message to another message is a non-starter.

If a __del__ method depends on attributes set in the __init__, then the programmer needs to decide if they want to handle the possibility of __init__ failing, and therefore __del__ running without __init__ having completed.  For the stdlib, I think I'd lean toward handling such cases, in which case IMO the Pythonic thing to do is indeed to have a class attribute to provide the pre-__init__ default.

----------
nosy: +r.david.murray

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


More information about the Python-bugs-list mailing list