FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Replace PyObject_Del with PyObject_Free by vstinner · Pull Request #122453 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (12) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions Doc/c-api/typeobj.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
(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`.
Expand Down Expand Up @@ -1954,7 +1954,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
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
Expand Down
2 changes: 1 addition & 1 deletion Modules/_testcapi/gc.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ without_gc(PyObject *Py_UNUSED(self), PyObject *obj)
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;
}
Expand Down
6 changes: 3 additions & 3 deletions Modules/_testcapimodule.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static PyTypeObject _HashInheritanceTester_Type = {
"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 */
Expand Down Expand Up @@ -3587,7 +3587,7 @@ static PyTypeObject matmulType = {
0,
0,
PyType_GenericNew, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};

typedef struct {
Expand Down Expand Up @@ -3699,7 +3699,7 @@ static PyTypeObject awaitType = {
0,
0,
awaitObject_new, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};


Expand Down
2 changes: 1 addition & 1 deletion Objects/bytearrayobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,7 @@ PyTypeObject PyByteArray_Type = {
(initproc)bytearray___init__, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
PyType_GenericNew, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};

/*********************** Bytearray Iterator ****************************/
Expand Down
2 changes: 1 addition & 1 deletion Objects/bytesobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3066,7 +3066,7 @@ PyTypeObject PyBytes_Type = {
0, /* tp_init */
bytes_alloc, /* tp_alloc */
bytes_new, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};

void
Expand Down
4 changes: 2 additions & 2 deletions Objects/codeobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ PyTypeObject _PyLineIterator = {
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};

static lineiterator *
Expand Down Expand Up @@ -1443,7 +1443,7 @@ PyTypeObject _PyPositionsIterator = {
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};

static PyObject*
Expand Down
2 changes: 1 addition & 1 deletion Objects/complexobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1247,5 +1247,5 @@ PyTypeObject PyComplex_Type = {
0, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
actual_complex_new, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};
2 changes: 1 addition & 1 deletion Objects/fileobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ PyTypeObject PyStdPrinter_Type = {
0, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
0, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};


Expand Down
2 changes: 1 addition & 1 deletion Objects/odictobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ tp_dictoffset (__dict__) - -
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
Expand Down
2 changes: 1 addition & 1 deletion Objects/rangeobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ PyTypeObject PyRangeIter_Type = {
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 */
Expand Down
4 changes: 2 additions & 2 deletions Objects/typeobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7456,7 +7456,7 @@ PyTypeObject PyBaseObject_Type = {
object_init, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
object_new, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
};


Expand Down Expand Up @@ -8180,7 +8180,7 @@ type_ready_inherit(PyTypeObject *type)

/* 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.
Expand Down
2 changes: 1 addition & 1 deletion Objects/unicodeobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -15265,7 +15265,7 @@ PyTypeObject PyUnicode_Type = {
0, /* tp_init */
0, /* tp_alloc */
unicode_new, /* tp_new */
PyObject_Del, /* tp_free */
PyObject_Free, /* tp_free */
.tp_vectorcall = unicode_vectorcall,
};

Expand Down
2 changes: 1 addition & 1 deletion Python/optimizer.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ PyTypeObject _PyCounterOptimizer_Type = {
.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 *
Expand Down

Back | FazBrowse Home | New Git URL