mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-138342: Use a common utility for visiting an object's type (GH-138343)
Add `_PyObject_VisitType` in place of `tp_traverse` functions that only visit the object's type.
This commit is contained in:
parent
0d02e4d7d3
commit
4f6ecd10c2
24 changed files with 41 additions and 203 deletions
|
|
@ -2304,20 +2304,13 @@ generic_dealloc(PyObject *self)
|
|||
Py_DECREF(tp);
|
||||
}
|
||||
|
||||
static int
|
||||
generic_traverse(PyObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(Py_TYPE(self));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyType_Slot generic_slots[] = {
|
||||
{Py_tp_doc, (void *)generic_doc},
|
||||
{Py_tp_methods, generic_methods},
|
||||
{Py_tp_dealloc, generic_dealloc},
|
||||
{Py_tp_alloc, PyType_GenericAlloc},
|
||||
{Py_tp_free, PyObject_GC_Del},
|
||||
{Py_tp_traverse, generic_traverse},
|
||||
{Py_tp_traverse, _PyObject_VisitType},
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue