Author terry.reedy
Recipients chortos, haypo, petri.lehtinen, python-dev, terry.reedy
Date 2013-09-15.05:30:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1379223039.45.0.44528749715.issue12085@psf.upfronthosting.co.za>
In-reply-to
Content
I think this patch is a false solution and should be reverted. Oleg should have been told to use sys.version to make the correct call. Given how Python is, that is the correct solution to his problem.

The result of this patch is #19021: an AttributeError on shutdown when getattr gets cleared before the Popen instance.

The problem of Python putting out an uncatchable error message when deleting an uninitialized instance is generic and not specific to Popen.

class C():
    def __init__(self): self.a = 1
    def __del__(self): self.a

try:
    C(1)
except (TypeError, AttributeError): pass

# prints
Exception AttributeError: "'C' object has no attribute 'a'" in <bound method C.__del__ of <__main__.C object at 0x00000000033FB128>> ignored

If there is to be any change, it should be as generic as the problem. Perhaps that message should simply be eliminated. Perhaps it should be a Warning, which could be blocked. Perhaps there should be a real AttributeError chained with the TypeError.


What we should not do and should not tell people to do is add at least one getattr call to every __del__ method.
History
Date User Action Args
2013-09-15 05:30:39terry.reedysetrecipients: + terry.reedy, haypo, chortos, python-dev, petri.lehtinen
2013-09-15 05:30:39terry.reedysetmessageid: <1379223039.45.0.44528749715.issue12085@psf.upfronthosting.co.za>
2013-09-15 05:30:39terry.reedylinkissue12085 messages
2013-09-15 05:30:38terry.reedycreate