• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PyObject_GC_UnTrack函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PyObject_GC_UnTrack函数的典型用法代码示例。如果您正苦于以下问题:C++ PyObject_GC_UnTrack函数的具体用法?C++ PyObject_GC_UnTrack怎么用?C++ PyObject_GC_UnTrack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PyObject_GC_UnTrack函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Aeternam,项目名称:server_status,代码行数:26,代码来源:Generator.c


示例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);
}
开发者ID:vietlq,项目名称:cython,代码行数:25,代码来源:Generator.c


示例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;
}
开发者ID:blackberry,项目名称:ALF,代码行数:29,代码来源:symbol.c


示例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);
}
开发者ID:ARK4579,项目名称:cpython,代码行数:7,代码来源:namespaceobject.c


示例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);
}
开发者ID:gencer,项目名称:psycopg2,代码行数:34,代码来源:connection_type.c


示例6: islice_dealloc

static void
islice_dealloc(isliceobject *lz)
{
	PyObject_GC_UnTrack(lz);
	Py_XDECREF(lz->it);
	lz->ob_type->tp_free(lz);
}
开发者ID:Belxjander,项目名称:Kirito,代码行数:7,代码来源:itertoolsmodule.c


示例7: chain_dealloc

static void
chain_dealloc(chainobject *lz)
{
	PyObject_GC_UnTrack(lz);
	Py_XDECREF(lz->ittuple);
	lz->ob_type->tp_free(lz);
}
开发者ID:Belxjander,项目名称:Kirito,代码行数:7,代码来源:itertoolsmodule.c


示例8: lookup_dealloc

static void
lookup_dealloc(lookup *self)
{
  PyObject_GC_UnTrack((PyObject *)self);
  lookup_clear(self);
  Py_TYPE(self)->tp_free((PyObject*)self);
}
开发者ID:JohnDoes95,项目名称:project_parser,代码行数:7,代码来源:_zope_interface_coptimizations.c


示例9: PyJudyIntSetIter_dealloc

static void PyJudyIntSetIter_dealloc(PyJudyIntSetIter* self)
{
	PyObject_GC_UnTrack(self);
	Py_XDECREF(self->s);
	self->s = 0;
	PyObject_GC_Del(self);
}
开发者ID:dohop,项目名称:py-judy,代码行数:7,代码来源:judy_int_set.c


示例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);
}
开发者ID:corona10,项目名称:pyston,代码行数:7,代码来源:descr.cpp


示例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)
}
开发者ID:cristipp,项目名称:JyNI,代码行数:31,代码来源:tupleobject.c


示例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);
}
开发者ID:amrik,项目名称:pyvertica,代码行数:31,代码来源:connection_type.c


示例13: weakref_dealloc

static void
weakref_dealloc(PyWeakReference *self)
{
    PyObject_GC_UnTrack((PyObject *)self);
    clear_weakref(self);
    PyObject_GC_Del(self);
}
开发者ID:MatiasNAmendola,项目名称:cleese,代码行数:7,代码来源:weakrefobject.c


示例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);
}
开发者ID:Apoorvadabhere,项目名称:cpython,代码行数:7,代码来源:context.c


示例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)
}
开发者ID:datnamer,项目名称:asyncpg,代码行数:33,代码来源:recordobj.c


示例16: _Node_Del

void _Node_Del(NodeObject *node)
{
  PyObject_GC_UnTrack(node);

  Py_CLEAR(node->parent);
  PyObject_GC_Del((PyObject *) node);
}
开发者ID:abed-hawa,项目名称:amara,代码行数:7,代码来源:node.c


示例17: Noddy_dealloc

static void
Noddy_dealloc(Noddy* self)
{
    PyObject_GC_UnTrack(self);
    Noddy_clear(self);
    Py_TYPE(self)->tp_free((PyObject*)self);
}
开发者ID:1st1,项目名称:cpython,代码行数:7,代码来源:noddy4.c


示例18: verifying_dealloc

static void
verifying_dealloc(verify *self)
{
  PyObject_GC_UnTrack((PyObject *)self);   	
  verifying_clear(self);
  Py_TYPE(self)->tp_free((PyObject*)self);
}
开发者ID:JohnDoes95,项目名称:project_parser,代码行数:7,代码来源:_zope_interface_coptimizations.c


示例19: buffer_dealloc

static void
buffer_dealloc(BufferObject *self)
{
    PyObject_GC_UnTrack(self);
    Buffer_Reset(self);
    Py_TYPE(self)->tp_free(self);
}
开发者ID:Anugrahaa,项目名称:anagrammatic,代码行数:7,代码来源:newbuffer.c


示例20: weakref_dealloc

static void
weakref_dealloc(PyObject *self)
{
    PyObject_GC_UnTrack(self);
    clear_weakref((PyWeakReference *) self);
    Py_TYPE(self)->tp_free(self);
}
开发者ID:guangwong,项目名称:pyston,代码行数:7,代码来源:weakrefobject.c



注:本文中的PyObject_GC_UnTrack函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PyObject_GetAttr函数代码示例发布时间:2022-05-30
下一篇:
C++ PyObject_GC_Track函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap