Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09a2ae5

Browse files
committed
Change signature of _PyObject_GC_Malloc to match PyObject_MALLOC.
PyObject_Del and PyObject_GC_Del can now be used as a function designators.
1 parent 626d774 commit 09a2ae5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Objects/typeobject.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ PyType_GenericAlloc(PyTypeObject *type, int nitems)
190190
const size_t size = _PyObject_VAR_SIZE(type, nitems);
191191

192192
if (PyType_IS_GC(type))
193-
obj = _PyObject_GC_Malloc(type, nitems);
193+
obj = _PyObject_GC_Malloc(size);
194194
else
195195
obj = PyObject_MALLOC(size);
196196

@@ -1187,12 +1187,12 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
11871187
/* Always override allocation strategy to use regular heap */
11881188
type->tp_alloc = PyType_GenericAlloc;
11891189
if (type->tp_flags & Py_TPFLAGS_HAVE_GC) {
1190-
type->tp_free = _PyObject_GC_Del;
1190+
type->tp_free = PyObject_GC_Del;
11911191
type->tp_traverse = subtype_traverse;
11921192
type->tp_clear = base->tp_clear;
11931193
}
11941194
else
1195-
type->tp_free = _PyObject_Del;
1195+
type->tp_free = PyObject_Del;
11961196

11971197
/* Initialize the rest */
11981198
if (PyType_Ready(type) < 0) {
@@ -1494,7 +1494,7 @@ PyTypeObject PyType_Type = {
14941494
0, /* tp_init */
14951495
0, /* tp_alloc */
14961496
type_new, /* tp_new */
1497-
_PyObject_GC_Del, /* tp_free */
1497+
PyObject_GC_Del, /* tp_free */
14981498
(inquiry)type_is_gc, /* tp_is_gc */
14991499
};
15001500

@@ -1709,7 +1709,7 @@ PyTypeObject PyBaseObject_Type = {
17091709
object_init, /* tp_init */
17101710
PyType_GenericAlloc, /* tp_alloc */
17111711
PyType_GenericNew, /* tp_new */
1712-
_PyObject_Del, /* tp_free */
1712+
PyObject_Del, /* tp_free */
17131713
};
17141714

17151715

@@ -4272,5 +4272,5 @@ PyTypeObject PySuper_Type = {
42724272
super_init, /* tp_init */
42734273
PyType_GenericAlloc, /* tp_alloc */
42744274
PyType_GenericNew, /* tp_new */
4275-
_PyObject_GC_Del, /* tp_free */
4275+
PyObject_GC_Del, /* tp_free */
42764276
};

0 commit comments

Comments
 (0)