Skip to content
Prev Previous commit
Next Next commit
Make type_clear() compatible with inquiry
  • Loading branch information
chrstphrchvz authored Dec 5, 2023
commit a8b30d91fba3dc086c20fdc563483cc53d3ce09c
6 changes: 4 additions & 2 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5292,8 +5292,10 @@ type_traverse(PyObject *self, visitproc visit, void *arg)
}

static int
type_clear(PyTypeObject *type)
type_clear(PyObject *self)
{
PyTypeObject *type = (PyTypeObject *)self;

/* Because of type_is_gc(), the collector only calls this
for heaptypes. */
_PyObject_ASSERT((PyObject *)type, type->tp_flags & Py_TPFLAGS_HEAPTYPE);
Expand Down Expand Up @@ -5376,7 +5378,7 @@ PyTypeObject PyType_Type = {
Py_TPFLAGS_ITEMS_AT_END, /* tp_flags */
type_doc, /* tp_doc */
type_traverse, /* tp_traverse */
(inquiry)type_clear, /* tp_clear */
type_clear, /* tp_clear */
0, /* tp_richcompare */
offsetof(PyTypeObject, tp_weaklist), /* tp_weaklistoffset */
0, /* tp_iter */
Expand Down