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
|
|
@ -164,14 +164,6 @@ newSHA512object(sha2_state *state)
|
|||
}
|
||||
|
||||
/* Internal methods for our hash objects. */
|
||||
|
||||
static int
|
||||
SHA2_traverse(PyObject *ptr, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(Py_TYPE(ptr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SHA256_dealloc(PyObject *op)
|
||||
{
|
||||
|
|
@ -519,7 +511,7 @@ static PyType_Slot sha256_types_slots[] = {
|
|||
{Py_tp_dealloc, SHA256_dealloc},
|
||||
{Py_tp_methods, SHA256_methods},
|
||||
{Py_tp_getset, SHA256_getseters},
|
||||
{Py_tp_traverse, SHA2_traverse},
|
||||
{Py_tp_traverse, _PyObject_VisitType},
|
||||
{0,0}
|
||||
};
|
||||
|
||||
|
|
@ -527,7 +519,7 @@ static PyType_Slot sha512_type_slots[] = {
|
|||
{Py_tp_dealloc, SHA512_dealloc},
|
||||
{Py_tp_methods, SHA512_methods},
|
||||
{Py_tp_getset, SHA512_getseters},
|
||||
{Py_tp_traverse, SHA2_traverse},
|
||||
{Py_tp_traverse, _PyObject_VisitType},
|
||||
{0,0}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue