Terry J. Reedy added the comment:

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.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12085>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to