(doesn't have the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit set), it is
permissible to call the object deallocator directly instead of via
:c:member:`~PyTypeObject.tp_free`. The object deallocator should be the one used to allocate the
- instance; this is normally :c:func:`PyObject_Del` if the instance was allocated
+ instance; this is normally :c:func:`PyObject_Free` if the instance was allocated
using :c:macro:`PyObject_New` or :c:macro:`PyObject_NewVar`, or
:c:func:`PyObject_GC_Del` if the instance was allocated using
:c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`.
match :c:func:`PyType_GenericAlloc` and the value of the
:c:macro:`Py_TPFLAGS_HAVE_GC` flag bit.
- For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`.
+ For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Free`.
.. c:member:: inquiry PyTypeObject.tp_is_gc
if (PyType_IS_GC(tp)) {
// Don't try this at home, kids:
tp->tp_flags -= Py_TPFLAGS_HAVE_GC;
- tp->tp_free = PyObject_Del;
+ tp->tp_free = PyObject_Free;
tp->tp_traverse = NULL;
tp->tp_clear = NULL;
}
"hashinheritancetester", /* Name of this type */
sizeof(PyObject), /* Basic object size */
0, /* Item size for varobject */
- (destructor)PyObject_Del, /* tp_dealloc */
+ (destructor)PyObject_Free, /* tp_dealloc */
0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
0,
0,
PyType_GenericNew, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
typedef struct {
0,
0,
awaitObject_new, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
(initproc)bytearray___init__, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
PyType_GenericNew, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
/*********************** Bytearray Iterator ****************************/
0, /* tp_init */
bytes_alloc, /* tp_alloc */
bytes_new, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
void
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
static lineiterator *
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
static PyObject*
0, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
actual_complex_new, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
0, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
0, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
tp_init __init__ object_init dict_init
tp_alloc - PyType_GenericAlloc (repeated)
tp_new __new__ object_new dict_new
-tp_free - PyObject_Del PyObject_GC_Del
+tp_free - PyObject_Free PyObject_GC_Del
================= ================ =================== ================
Relevant Methods
sizeof(_PyRangeIterObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
- (destructor)PyObject_Del, /* tp_dealloc */
+ (destructor)PyObject_Free, /* tp_dealloc */
0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
object_init, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
object_new, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
};
/* Sanity check for tp_free. */
if (_PyType_IS_GC(type) && (type->tp_flags & Py_TPFLAGS_BASETYPE) &&
- (type->tp_free == NULL || type->tp_free == PyObject_Del))
+ (type->tp_free == NULL || type->tp_free == PyObject_Free))
{
/* This base class needs to call tp_free, but doesn't have
* one, or its tp_free is for non-gc'ed objects.
0, /* tp_init */
0, /* tp_alloc */
unicode_new, /* tp_new */
- PyObject_Del, /* tp_free */
+ PyObject_Free, /* tp_free */
.tp_vectorcall = unicode_vectorcall,
};
.tp_itemsize = 0,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
.tp_methods = counter_optimizer_methods,
- .tp_dealloc = (destructor)PyObject_Del,
+ .tp_dealloc = (destructor)PyObject_Free,
};
PyObject *