[issue6294] Improve shutdown exception ignored message

R. David Murray report at bugs.python.org
Wed Jun 17 04:50:43 CEST 2009


R. David Murray <rdmurray at bitdance.com> added the comment:

Since 3.1 is in final release candidate, a change like this is not
appropriate for 3.1.

This error message is generated in PyErr_WriteUnraisable, which is
called from many contexts, including __del__ methods. A __del__ method
called during shutdown is most likely what is generating the error you
are speaking of, but as far as I know the __del__ method has no way to
know that it is being called during shutdown in particular.  So the
proposed fix to the message won't work.

The reason this message is so mysterious is that in this particular case
there is additional information that normally appears in the message
that has apparently also been nullified during shutdown and that token
is simply omitted.  This appears to be a bug, since the code substitutes
<unknown> for other elements that are substituted into the message if
they are NULL, but does not do so for the object passed in to the
subroutine.  Either the fact that the object prints as the empty string
is a bug, or <unknown> should be substituted for it.  With that bug
fixed, the message would read:

   Exception TypeError: "'NoneType' object is not callable" in <unknown>
ignored

which is more easily parsed correctly.  As long as we're mucking about
in that code, though, perhaps a more generic reformatting of the message
would be clearer even with that bug fixed. I suggest:

   The following Exception of type TypeError was raised in <unknown> but
was ignored: 'NoneType' object is not callable

----------
components: +Interpreter Core
nosy: +r.david.murray
priority:  -> low
stage:  -> test needed
type: feature request -> behavior

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


More information about the Python-bugs-list mailing list