Exemplo n.º 1
0
// Delete an Element (or just decrement its reference count)
    PyObject *
    DeleteElement(PyObject *self, PyObject *args)
    {
        long addr = PyLong_AsLong(PyTuple_GET_ITEM(args, 0));
        Element *elm = Id2Element(addr);

        elm->DecRef();

        // if there are no more references then delete element
        if (!elm->IsReferenced()) { // && elm->GetParent() == NULL) {
            //pointers[elm]--;
            //assert(pointers[elm] == 0);
            //printf("delete: %p\n", elm);
            delete elm;
        }

        Py_RETURN_NONE;
    }