Finalization problems

Robin Becker robin at jessikat.fsnet.co.uk
Sat Aug 25 08:02:50 EDT 2001


Well I built a debug version under win32 and with an artificial repetitive call of the potential
trouble maker am getting NULL pointers in _Py_ForgetReference (called from _Py_Dealloc called
from insertdict ..... called from ceval.c set_exc_info at the line
        /* For b/w compatibility */
        PySys_SetObject("exc_type", type);
        PySys_SetObject("exc_value", value);
        PySys_SetObject("exc_traceback", tb);
}


the error is here

void
_Py_ForgetReference(register PyObject *op)
{
#ifdef SLOW_UNREF_CHECK
        register PyObject *p;
#endif
        if (op->ob_refcnt < 0)
                Py_FatalError("UNREF negative refcnt");

/******************************************
op->_ob_prev and op->_ob_next are NULL here
*******************************************/

        if (op == &refchain ||
            op->_ob_prev->_ob_next != op || op->_ob_next->_ob_prev != op)
                Py_FatalError("UNREF invalid object");
#ifdef SLOW_UNREF_CHECK
        for (p = refchain._ob_next; p != &refchain; p = p->_ob_next) {
                if (p == op)
                        break;
        }
        if (p == &refchain) /* Not found */
                Py_FatalError("UNREF unknown object");
#endif
        op->_ob_next->_ob_prev = op->_ob_prev;
        op->_ob_prev->_ob_next = op->_ob_next;
        op->_ob_next = op->_ob_prev = NULL;
#ifdef COUNT_ALLOCS
        op->ob_type->tp_free++;
#endif
}


the insertdict call is here

                Py_DECREF(old_value); /* which **CAN** re-enter */
                Py_DECREF(key);
        }
-- 
Robin Becker



More information about the Python-list mailing list