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

Georg Brandl g.brandl at gmx.net
Thu Sep 26 08:53:14 CEST 2013

Am 26.09.2013 08:22, schrieb Nick Coghlan:
> On 26 September 2013 15:42, Armin Rigo <arigo at tunes.org> wrote:
>> Hi Nick,
>> On Thu, Sep 26, 2013 at 6:59 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>>> I'm strongly in favour of Georg's one ("Exception in __del__ caught and not propagated").
>>> Such a change is highly unlikely to happen, as it would require
>>> changing every location where we call PyErr_WriteUnraisable.
>> Er, why?  It seems to me it's a matter of changing these three lines
>> in PyErr_WriteUnraisable():
>> -           PyFile_WriteString("Exception ignored in: ", f);
>> +          PyFile_WriteString("Exception in ", f);
>>             PyFile_WriteObject(obj, f, 0);
>> -           PyFile_WriteString("\n", f);
>> +          PyFile_WriteString(" caught and not propagated:\n", f);
>> I don't see what makes this technically different from the other
>> solution, "Cannot propagate exception..."
> Sure, that's doable, but it dumps the full repr of "obj" in the middle
> of the sentence. The thing that's not practical is the neat and tidy
> wording Georg proposed, because the thing passed as "obj" is actually
> an arbitrary Python object that may have a messy repr (like a bound
> method, which is what gets passed in the __del__ case), so there's
> definite merit in keeping that repr at the *end* of the header line.

Then this should be fine, I guess?

Exception caught and not propagated in: <....>


More information about the Python-Dev mailing list