static void __Pyx_Generator_dealloc(PyObject *self) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; PyObject_GC_UnTrack(gen); if (gen->gi_weakreflist != NULL) PyObject_ClearWeakRefs(self); if (gen->resume_label > 0) { // Generator is paused, so we need to close PyObject_GC_Track(self); #if PY_VERSION_HEX >= 0x030400a1 if (PyObject_CallFinalizerFromDealloc(self)) #else Py_TYPE(gen)->tp_del(self); if (self->ob_refcnt > 0) #endif { // resurrected. :( return; } PyObject_GC_UnTrack(self); } __Pyx_Generator_clear(self); PyObject_GC_Del(gen); }
static void __Pyx_Generator_dealloc(PyObject *self) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; PyObject_GC_UnTrack(gen); if (gen->gi_weakreflist != NULL) PyObject_ClearWeakRefs(self); PyObject_GC_Track(self); if (gen->resume_label > 0) { /* Generator is paused, so we need to close */ Py_TYPE(gen)->tp_del(self); if (self->ob_refcnt > 0) return; /* resurrected. :( */ } PyObject_GC_UnTrack(self); Py_CLEAR(gen->closure); Py_CLEAR(gen->classobj); Py_CLEAR(gen->exc_type); Py_CLEAR(gen->exc_value); Py_CLEAR(gen->exc_traceback); PyObject_GC_Del(gen); }
static PyObject * add_concat(SymbolObject *self, PyObject *args) { PyObject *child; void *newobj; int line_no; if (self->type != SYM_TYPE_CONCAT) { PyErr_Format(PyExc_RuntimeError, "Expecting concatenation symbol in add_concat(), got type %d for symbol %s (L%d)", self->type, self->name, self->line_no); return NULL; } if (!PyArg_ParseTuple(args, "O!i", &SymbolType, &child, &line_no)) return NULL; PyObject_GC_UnTrack(self); self->data.concat.n_children++; newobj = realloc(self->data.concat.children, self->data.concat.n_children * sizeof(PyObject *)); if (!newobj) { self->data.concat.n_children--; PyObject_GC_Track(self); PyErr_NoMemory(); return NULL; } self->data.concat.children = (PyObject **)newobj; self->data.concat.children[self->data.concat.n_children-1] = child; Py_INCREF(child); PyObject_GC_Track(self); ODBGN(D_PRS, " \\(%s concat) %s\n", self->name, SYMOBJ(child)->name); Py_RETURN_NONE; }
static void namespace_dealloc(_PyNamespaceObject *ns) { PyObject_GC_UnTrack(ns); Py_CLEAR(ns->ns_dict); Py_TYPE(ns)->tp_free((PyObject *)ns); }
static void connection_dealloc(PyObject* obj) { connectionObject *self = (connectionObject *)obj; /* Make sure to untrack the connection before calling conn_close, which may * allow a different thread to try and dealloc the connection again, * resulting in a double-free segfault (ticket #166). */ PyObject_GC_UnTrack(self); conn_close(self); if (self->weakreflist) { PyObject_ClearWeakRefs(obj); } conn_notice_clean(self); PyMem_Free(self->dsn); PyMem_Free(self->encoding); if (self->critical) free(self->critical); if (self->cancel) PQfreeCancel(self->cancel); connection_clear(self); pthread_mutex_destroy(&(self->lock)); Dprintf("connection_dealloc: deleted connection object at %p, refcnt = " FORMAT_CODE_PY_SSIZE_T, obj, Py_REFCNT(obj) ); Py_TYPE(obj)->tp_free(obj); }
static void islice_dealloc(isliceobject *lz) { PyObject_GC_UnTrack(lz); Py_XDECREF(lz->it); lz->ob_type->tp_free(lz); }
static void chain_dealloc(chainobject *lz) { PyObject_GC_UnTrack(lz); Py_XDECREF(lz->ittuple); lz->ob_type->tp_free(lz); }
static void lookup_dealloc(lookup *self) { PyObject_GC_UnTrack((PyObject *)self); lookup_clear(self); Py_TYPE(self)->tp_free((PyObject*)self); }
static void PyJudyIntSetIter_dealloc(PyJudyIntSetIter* self) { PyObject_GC_UnTrack(self); Py_XDECREF(self->s); self->s = 0; PyObject_GC_Del(self); }
void BoxedClassmethod::dealloc(Box* _self) noexcept { BoxedClassmethod* self = static_cast<BoxedClassmethod*>(_self); PyObject_GC_UnTrack(self); Py_XDECREF(self->cm_callable); self->cls->tp_free(self); }
static void tupledealloc(register PyTupleObject *op) { JyNIDebugOp(JY_NATIVE_FINALIZE, op, -1); register Py_ssize_t i; register Py_ssize_t len = Py_SIZE(op); PyObject_GC_UnTrack(op); Py_TRASHCAN_SAFE_BEGIN(op) if (len > 0) { i = len; while (--i >= 0) Py_XDECREF(op->ob_item[i]); #if PyTuple_MAXSAVESIZE > 0 if (len < PyTuple_MAXSAVESIZE && numfree[len] < PyTuple_MAXFREELIST && Py_TYPE(op) == &PyTuple_Type) { JyNIDebugOp(JY_NATIVE_FREE | JY_INLINE_MASK, op, -1); JyNI_CleanUp_JyObject(AS_JY_WITH_GC(op)); op->ob_item[0] = (PyObject *) free_list[len]; numfree[len]++; free_list[len] = op; goto done; /* return */ } #endif } JyNI_CleanUp_JyObject(AS_JY_WITH_GC(op)); Py_TYPE(op)->tp_free((PyObject *)op); done: Py_TRASHCAN_SAFE_END(op) }
static void connection_dealloc(PyObject* obj) { connectionObject *self = (connectionObject *)obj; PyObject_GC_UnTrack(self); if (self->closed == 0) conn_close(self); conn_notice_clean(self); if (self->dsn) free(self->dsn); if (self->encoding) free(self->encoding); if (self->critical) free(self->critical); Py_CLEAR(self->async_cursor); Py_CLEAR(self->notice_list); Py_CLEAR(self->notice_filter); Py_CLEAR(self->notifies); Py_CLEAR(self->string_types); Py_CLEAR(self->binary_types); pthread_mutex_destroy(&(self->lock)); Dprintf("connection_dealloc: deleted connection object at %p, refcnt = " FORMAT_CODE_PY_SSIZE_T, obj, obj->ob_refcnt ); obj->ob_type->tp_free(obj); }
static void weakref_dealloc(PyWeakReference *self) { PyObject_GC_UnTrack((PyObject *)self); clear_weakref(self); PyObject_GC_Del(self); }
static void typecast_dealloc(typecastObject *self) { PyObject_GC_UnTrack(self); typecast_clear(self); Py_TYPE(self)->tp_free((PyObject *)self); }
static void contextvar_tp_dealloc(PyContextVar *self) { PyObject_GC_UnTrack(self); (void)contextvar_tp_clear(self); Py_TYPE(self)->tp_free(self); }
static void record_dealloc(ApgRecordObject *o) { Py_ssize_t i; Py_ssize_t len = Py_SIZE(o); PyObject_GC_UnTrack(o); o->self_hash = -1; Py_CLEAR(o->mapping); Py_TRASHCAN_SAFE_BEGIN(o) if (len > 0) { i = len; while (--i >= 0) { Py_CLEAR(o->ob_item[i]); } if (len < ApgRecord_MAXSAVESIZE && numfree[len] < ApgRecord_MAXFREELIST && ApgRecord_CheckExact(o)) { o->ob_item[0] = (PyObject *) free_list[len]; numfree[len]++; free_list[len] = o; goto done; /* return */ } } Py_TYPE(o)->tp_free((PyObject *)o); done: Py_TRASHCAN_SAFE_END(o) }
void _Node_Del(NodeObject *node) { PyObject_GC_UnTrack(node); Py_CLEAR(node->parent); PyObject_GC_Del((PyObject *) node); }
static void Noddy_dealloc(Noddy* self) { PyObject_GC_UnTrack(self); Noddy_clear(self); Py_TYPE(self)->tp_free((PyObject*)self); }
static void verifying_dealloc(verify *self) { PyObject_GC_UnTrack((PyObject *)self); verifying_clear(self); Py_TYPE(self)->tp_free((PyObject*)self); }
static void buffer_dealloc(BufferObject *self) { PyObject_GC_UnTrack(self); Buffer_Reset(self); Py_TYPE(self)->tp_free(self); }
static void weakref_dealloc(PyObject *self) { PyObject_GC_UnTrack(self); clear_weakref((PyWeakReference *) self); Py_TYPE(self)->tp_free(self); }
static void resulttuple_dealloc(PyObject *self) { Py_ssize_t i, len; PyObject_GC_UnTrack (self); Py_TRASHCAN_SAFE_BEGIN (self) /* Free the tuple items and, if there is space, save the tuple object * pointer to the front of the free list for its size. Otherwise free it. */ len = Py_SIZE (self); if (len > 0) { for (i=0; i < len; i++) { Py_XDECREF (PyTuple_GET_ITEM (self, i)); } if (len < PyGIResultTuple_MAXSAVESIZE && numfree[len] < PyGIResultTuple_MAXFREELIST) { PyTuple_SET_ITEM (self, 0, free_list[len]); numfree[len]++; free_list[len] = self; goto done; } } Py_TYPE (self)->tp_free (self); done: Py_TRASHCAN_SAFE_END (self) }
static void repeat_dealloc(repeatobject *ro) { PyObject_GC_UnTrack(ro); Py_XDECREF(ro->element); ro->ob_type->tp_free(ro); }
/* * Deallocate the memory used by the PKCS12 object * * Arguments: self - The PKCS12 object * Returns: None */ static void crypto_PKCS12_dealloc(crypto_PKCS12Obj *self) { PyObject_GC_UnTrack(self); crypto_PKCS12_clear(self); PyObject_GC_Del(self); }
static void weakref_dealloc(PyObject *self) { PyObject_GC_UnTrack(self); clear_weakref((PyWeakReference *) self); self->ob_type->tp_free(self); }
static void reversed_dealloc(reversedobject *ro) { PyObject_GC_UnTrack(ro); Py_XDECREF(ro->seq); Py_TYPE(ro)->tp_free(ro); }
static void sorted_btree_dealloc(btsort_pyobject *self) { PyObject_GC_UnTrack(self); if (self->flags & BT_FLAG_INITED) traverse_nodes(self, 0, dealloc_visitor, NULL); self->ob_type->tp_free((PyObject *)self); }
static void token_tp_dealloc(PyContextToken *self) { PyObject_GC_UnTrack(self); (void)token_tp_clear(self); Py_TYPE(self)->tp_free(self); }
static void tupledealloc(register PyTupleObject *op) { register Py_ssize_t i; register Py_ssize_t len = Py_SIZE(op); PyObject_GC_UnTrack(op); Py_TRASHCAN_SAFE_BEGIN(op) if (len > 0) { i = len; while (--i >= 0) Py_XDECREF(op->ob_item[i]); #if PyTuple_MAXSAVESIZE > 0 if (len < PyTuple_MAXSAVESIZE && numfree[len] < PyTuple_MAXFREELIST && Py_TYPE(op) == &PyTuple_Type) { op->ob_item[0] = (PyObject *) free_list[len]; numfree[len]++; free_list[len] = op; goto done; /* return */ } #endif } Py_TYPE(op)->tp_free((PyObject *)op); done: Py_TRASHCAN_SAFE_END(op) }
static PyObject * define_function(SymbolObject *self, PyObject *args) { int line_no; if (self->type != SYM_TYPE_ABSTRACT) { PyErr_Format(PyExc_RuntimeError, "Expecting abstract symbol in define_function(), got type %d for symbol %s (L%d)", self->type, self->name, self->line_no); return NULL; } PyObject_GC_UnTrack(self); if (!PyArg_ParseTuple(args, "OOi", &self->data.func.f, &self->data.func.args, &line_no)) { PyObject_GC_Track(self); return NULL; } if (!PyCallable_Check(self->data.func.f)) { PyErr_Format(PyExc_RuntimeError, "Expecting a callable function (L%d)", line_no); PyObject_GC_Track(self); return NULL; } if (!PySequence_Check(self->data.func.args)) { PyErr_Format(PyExc_RuntimeError, "Expecting sequence (L%d)", line_no); PyObject_GC_Track(self); return NULL; } Py_INCREF(self->data.func.f); Py_INCREF(self->data.func.args); self->type = SYM_TYPE_FUNCTION; self->_generate = _generate_function; self->line_no = line_no; PyObject_GC_Track(self); Py_RETURN_NONE; }