Handling Python Fatal Error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Handling Python Fatal Error (/thread-32452.html) |
Handling Python Fatal Error - richajain1785 - Feb-10-2021 Hello, I have been trying to handle errors in my python code using try & except, but this is not able to handle refcount error which causes my application to crash. The error I get is: Fatal Python error: deallocating None Current thread 0x00007f93428bb700 (most recent call first): <Stack Trace which is not helping> How can I handle this kind of error? Or how to identify the root cause for this? Any help will be appreciated. Thanks. RE: Handling Python Fatal Error - Larz60+ - Feb-10-2021 Please show an actual python traceback (error message) unaltered and complete, within bbcode error tags RE: Handling Python Fatal Error - richajain1785 - Feb-11-2021 (Feb-10-2021, 06:25 PM)Larz60+ Wrote: Please show an actual python traceback (error message) Here is the complete error:
RE: Handling Python Fatal Error - Larz60+ - Feb-11-2021 This error message still looks incomplete as there is no link back to your code (no traceback) which is what I was looking for. So unfortunately it doesn't help much. was there a part of the message not included? RE: Handling Python Fatal Error - richajain1785 - Feb-11-2021 (Feb-11-2021, 09:55 AM)Larz60+ Wrote: This error message still looks incomplete as there is no link back to your code (no traceback) which is what I was looking for. This is all I get in the error. myapp.py is my application python source. RE: Handling Python Fatal Error - Larz60+ - Feb-11-2021 Can't say without seeing code. RE: Handling Python Fatal Error - nilamo - Feb-12-2021 Looks like an error in the glib wrapper. Without knowing what you're doing, we'd just be making guesses. RE: Handling Python Fatal Error - Tails86 - Oct-14-2021 Sorry for reviving an old thread. I just figured out what this error means after many hours of digging, and it frustrates me that I couldn't find good documentation on the error itself. This seems like a very easy mistake to make. None is a special, global object. What "deallocating None" means is that the reference count on "None" has reached 0, and None is to be deallocated (AKA deleted). This is a bad thing! It likely means that a Python library written in C/C++ is returning Py_None for use in Python proper without first calling Py_INCREF(Py_None). The error then shows itself elsewhere in code because the ref count on None is now 1 too few. When someone throws away its reference to None, only then will this error present itself. It may or may not be a problem in GLib.py if this is the case. |