Re: [Python-Dev] Revert #12085 fix for __del__ attribute error message

2013年9月22日 13:39:22 -0700

On 9/22/2013 2:41 PM, Guido van Rossum wrote:
On Sun, Sep 22, 2013 at 10:35 AM, Terry Reedy <[email protected]
<mailto:[email protected]>> wrote:
 On 9/21/2013 10:30 PM, Guido van Rossum wrote:
 Exceptions in __del__ point to bugs (sometimes in the stdlib) that
 should be fixed, period. The only reason they do not result in
 exceptions that are properly bubbled up and catchable is because
 __del__
 is called from a DECREF macro which has no return value.
 That is clear enough. What fooled me is the word 'ignored', in both
 the doc and message. How about 'skipped' (for technical reasons)?
That's a good point, although I'm not sure 'skipped' is better.
Only slightly ;-). The problem with both words is that they try to say two things. What happened, and what Python did about it.
Maybe use a more neutral verb like 'occurred'?
"Exception occurred in ..." is even better at say what happened.
I think we should then add an explict statement as to what Python did, and hint at what the user should do, something like
"Although caught internally, it still indicates a problem."
Otherwise, when no other output follows, as in
...
> del c
Exception ocurred in: <bound method C.__del__ ...
Traceback (most recent call last):
 File "<pyshell#0>", line 2, in __del__
AttributeError:
>>>
It may not be completely obvious to a non-expert that the traceback is not a 'real' traceback from an exception that was allowed to propagate, and that it did not stop execution and cannot be caught.
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to