Issue 6294: Improve shutdown exception ignored message (original) (raw)

Created on 2009-06-17 00:01 by terry.reedy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
errors.patch rob.lourens,2011-02-07 05:32 review
Messages (6)
msg89441 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2009-06-17 00:01
When (at least sometimes) exceptions occur during shutdown, warnings like the following appear: Exception TypeError: "'NoneType' object is not callable" in ignored This is apparently meant to be read as Exception <<TypeError: "'NoneType' object is not callable" in ...>> [was] ignored instead of, for instance Exception TypeError: "'NoneType' object is not callable" in ignored Even when parsed correctly, it is a bit mysterious (who/what ignored the exception?) to one not in the know and has generated more than one python-list thread. Suggestion (from John Machin): reword to something like Shutdown ignored this exception: TypeError: "'NoneType' object is not callable" This would tell people that they might need to find out more about the shutdown process. Would it be permissible to change this in 3.1?
msg89442 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-06-17 02:50
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 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 should be substituted for it. With that bug fixed, the message would read: Exception TypeError: "'NoneType' object is not callable" in 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 but was ignored: 'NoneType' object is not callable
msg89444 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2009-06-17 06:26
I should have said 3.1.1. Ie, would this be a bug fix or really a new feature that has to wait. Moot until someone does a patch.
msg89451 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-06-17 10:09
Ah, in that case then yes, the message bug can be fixed in 3.1.1 and 2.6.3. As for the message format, the format of messages is not considered part of the Python API, but changes to message formats can nonetheless cause compatibility issues that would argue for not backporting. However, because this is a message you can't even trap it should be completely safe to change it.
msg128100 - (view) Author: Rob Lourens (rob.lourens) Date: 2011-02-07 05:32
I agree with R. David Murray's suggestions, and have implemented it in the attached patch.
msg233003 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2014-12-21 22:17
Not sure what the original method to cause this message is. I’m guessing some code was trying to call a function that was set to None by the shutdown process, causing the exception message, and that repr() was also failing, causing the broken wording. Like this: $ python2 << PYTHON > class C: > def __repr__(self): return None() > def __del__(self): None() > x = C() > PYTHON Exception TypeError: "'NoneType' object is not callable" in ignored If this is the case, then it is the same problem as Issue 22836, where I have posted a test and a fix for Python 3.
History
Date User Action Args
2022-04-11 14:56:50 admin set github: 50543
2016-02-28 04šŸ”ž54 martin.panter set status: open -> closedsuperseder: Broken "Exception ignored in:" message on exceptions in __repr__resolution: duplicateversions: + Python 3.5, Python 3.6, - Python 3.2
2014-12-21 22:17:12 martin.panter set nosy: + martin.pantermessages: +
2013-05-19 17:00:32 jamadagni set nosy: + jamadagni
2011-02-07 05:32:16 rob.lourens set files: + errors.patchnosy: + rob.lourensmessages: + keywords: + patch
2009-06-17 10:09:31 r.david.murray set messages: +
2009-06-17 06:26:59 terry.reedy set messages: +
2009-06-17 02:50:41 r.david.murray set priority: lowtype: enhancement -> behaviorcomponents: + Interpreter Corenosy: + r.david.murraymessages: + stage: test needed
2009-06-17 00:01:50 terry.reedy create