本文整理汇总了C++中PyObject_GC_UnTrack函数的典型用法代码示例。如果您正苦于以下问题:C++ PyObject_GC_UnTrack函数的具体用法?C++ PyObject_GC_UnTrack怎么用?C++ PyObject_GC_UnTrack使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PyObject_GC_UnTrack函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __Pyx_Generator_dealloc
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);
}
示例2: __Pyx_Generator_dealloc
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);
}
示例3: add_concat
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;
}
示例4: namespace_dealloc
static void
namespace_dealloc(_PyNamespaceObject *ns)
{
PyObject_GC_UnTrack(ns);
Py_CLEAR(ns->ns_dict);
Py_TYPE(ns)->tp_free((PyObject *)ns);
}
示例5: connection_dealloc
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);
}
示例6: islice_dealloc
static void
islice_dealloc(isliceobject *lz)
{
PyObject_GC_UnTrack(lz);
Py_XDECREF(lz->it);
lz->ob_type->tp_free(lz);
}
示例7: chain_dealloc
static void
chain_dealloc(chainobject *lz)
{
PyObject_GC_UnTrack(lz);
Py_XDECREF(lz->ittuple);
lz->ob_type->tp_free(lz);
}
示例8: lookup_dealloc
static void
lookup_dealloc(lookup *self)
{
PyObject_GC_UnTrack((PyObject *)self);
lookup_clear(self);
Py_TYPE(self)->tp_free((PyObject*)self);
}
示例9: PyJudyIntSetIter_dealloc
static void PyJudyIntSetIter_dealloc(PyJudyIntSetIter* self)
{
PyObject_GC_UnTrack(self);
Py_XDECREF(self->s);
self->s = 0;
PyObject_GC_Del(self);
}
示例10: PyObject_GC_UnTrack
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);
}
示例11: tupledealloc
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)
}
示例12: connection_dealloc
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);
}
示例13: weakref_dealloc
static void
weakref_dealloc(PyWeakReference *self)
{
PyObject_GC_UnTrack((PyObject *)self);
clear_weakref(self);
PyObject_GC_Del(self);
}
示例14: contextvar_tp_dealloc
static void
contextvar_tp_dealloc(PyContextVar *self)
{
PyObject_GC_UnTrack(self);
(void)contextvar_tp_clear(self);
Py_TYPE(self)->tp_free(self);
}
示例15: record_dealloc
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)
}