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:
Peter Bierma 2025-09-01 12:20:33 -04:00 committed by GitHub
parent 0d02e4d7d3
commit 4f6ecd10c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 41 additions and 203 deletions

View file

@ -82,13 +82,6 @@ newMD5object(MD5State * st)
}
/* Internal methods for a hash object */
static int
MD5_traverse(PyObject *ptr, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(ptr));
return 0;
}
static void
MD5_dealloc(PyObject *op)
{
@ -246,7 +239,7 @@ static PyType_Slot md5_type_slots[] = {
{Py_tp_dealloc, MD5_dealloc},
{Py_tp_methods, MD5_methods},
{Py_tp_getset, MD5_getseters},
{Py_tp_traverse, MD5_traverse},
{Py_tp_traverse, _PyObject_VisitType},
{0,0}
};