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
|
|
@ -116,13 +116,6 @@ stmt_dealloc(PyObject *op)
|
|||
Py_DECREF(tp);
|
||||
}
|
||||
|
||||
static int
|
||||
stmt_traverse(PyObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(Py_TYPE(self));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Strip leading whitespace and comments from incoming SQL (null terminated C
|
||||
* string) and return a pointer to the first non-whitespace, non-comment
|
||||
|
|
@ -183,7 +176,7 @@ lstrip_sql(const char *sql)
|
|||
|
||||
static PyType_Slot stmt_slots[] = {
|
||||
{Py_tp_dealloc, stmt_dealloc},
|
||||
{Py_tp_traverse, stmt_traverse},
|
||||
{Py_tp_traverse, _PyObject_VisitType},
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue