MCPcopy Create free account
hub / github.com/chokkan/crfsuite / SwigPyObject_dealloc

Function SwigPyObject_dealloc

swig/python/export_wrap.cpp:1682–1715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1680SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1681
1682SWIGRUNTIME void
1683SwigPyObject_dealloc(PyObject *v)
1684{
1685 SwigPyObject *sobj = (SwigPyObject *) v;
1686 PyObject *next = sobj->next;
1687 if (sobj->own == SWIG_POINTER_OWN) {
1688 swig_type_info *ty = sobj->ty;
1689 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1690 PyObject *destroy = data ? data->destroy : 0;
1691 if (destroy) {
1692 /* destroy is always a VARARGS method */
1693 PyObject *res;
1694 if (data->delargs) {
1695 /* we need to create a temporary object to carry the destroy operation */
1696 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1697 res = SWIG_Python_CallFunctor(destroy, tmp);
1698 Py_DECREF(tmp);
1699 } else {
1700 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1701 PyObject *mself = PyCFunction_GET_SELF(destroy);
1702 res = ((*meth)(mself, v));
1703 }
1704 Py_XDECREF(res);
1705 }
1706#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1707 else {
1708 const char *name = SWIG_TypePrettyName(ty);
1709 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1710 }
1711#endif
1712 }
1713 Py_XDECREF(next);
1714 PyObject_DEL(v);
1715}
1716
1717SWIGRUNTIME PyObject*
1718SwigPyObject_append(PyObject* v, PyObject* next)

Callers

nothing calls this directly

Calls 2

SwigPyObject_NewFunction · 0.85
SWIG_TypePrettyNameFunction · 0.85

Tested by

no test coverage detected