mirror of
https://github.com/python/cpython.git
synced 2025-12-03 16:19:41 +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
|
|
@ -108,20 +108,13 @@ placeholder_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
return placeholder;
|
||||
}
|
||||
|
||||
static int
|
||||
placeholder_traverse(PyObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(Py_TYPE(self));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyType_Slot placeholder_type_slots[] = {
|
||||
{Py_tp_dealloc, placeholder_dealloc},
|
||||
{Py_tp_repr, placeholder_repr},
|
||||
{Py_tp_doc, (void *)placeholder_doc},
|
||||
{Py_tp_methods, placeholder_methods},
|
||||
{Py_tp_new, placeholder_new},
|
||||
{Py_tp_traverse, placeholder_traverse},
|
||||
{Py_tp_traverse, _PyObject_VisitType},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue