Skip to content

Commit e86e0d6

Browse files
committed
Use it in _multiprocessing and _sqlite.
1 parent a05d9d0 commit e86e0d6

File tree

3 files changed

+3
-24
lines changed

3 files changed

+3
-24
lines changed

Modules/_multiprocessing/semaphore.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -720,13 +720,6 @@ _multiprocessing_SemLock___exit___impl(SemLockObject *self,
720720
return _multiprocessing_SemLock_release_impl(self);
721721
}
722722

723-
static int
724-
semlock_traverse(PyObject *s, visitproc visit, void *arg)
725-
{
726-
Py_VISIT(Py_TYPE(s));
727-
return 0;
728-
}
729-
730723
/*
731724
* Semaphore methods
732725
*/
@@ -773,7 +766,7 @@ static PyType_Slot _PyMp_SemLockType_slots[] = {
773766
{Py_tp_members, semlock_members},
774767
{Py_tp_alloc, PyType_GenericAlloc},
775768
{Py_tp_new, _multiprocessing_SemLock},
776-
{Py_tp_traverse, semlock_traverse},
769+
{Py_tp_traverse, _PyObject_VisitType},
777770
{Py_tp_free, PyObject_GC_Del},
778771
{Py_tp_doc, (void *)PyDoc_STR("Semaphore/Mutex type")},
779772
{0, 0},

Modules/_sqlite/prepare_protocol.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ pysqlite_prepare_protocol_init(PyObject *self, PyObject *args, PyObject *kwargs)
2929
return 0;
3030
}
3131

32-
static int
33-
pysqlite_prepare_protocol_traverse(PyObject *self, visitproc visit, void *arg)
34-
{
35-
Py_VISIT(Py_TYPE(self));
36-
return 0;
37-
}
38-
3932
static void
4033
pysqlite_prepare_protocol_dealloc(PyObject *self)
4134
{
@@ -50,7 +43,7 @@ PyDoc_STRVAR(doc, "PEP 246 style object adaption protocol type.");
5043
static PyType_Slot type_slots[] = {
5144
{Py_tp_dealloc, pysqlite_prepare_protocol_dealloc},
5245
{Py_tp_init, pysqlite_prepare_protocol_init},
53-
{Py_tp_traverse, pysqlite_prepare_protocol_traverse},
46+
{Py_tp_traverse, _PyObject_VisitType},
5447
{Py_tp_doc, (void *)doc},
5548
{0, NULL},
5649
};

Modules/_sqlite/statement.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ stmt_dealloc(PyObject *op)
116116
Py_DECREF(tp);
117117
}
118118

119-
static int
120-
stmt_traverse(PyObject *self, visitproc visit, void *arg)
121-
{
122-
Py_VISIT(Py_TYPE(self));
123-
return 0;
124-
}
125-
126119
/*
127120
* Strip leading whitespace and comments from incoming SQL (null terminated C
128121
* string) and return a pointer to the first non-whitespace, non-comment
@@ -183,7 +176,7 @@ lstrip_sql(const char *sql)
183176

184177
static PyType_Slot stmt_slots[] = {
185178
{Py_tp_dealloc, stmt_dealloc},
186-
{Py_tp_traverse, stmt_traverse},
179+
{Py_tp_traverse, _PyObject_VisitType},
187180
{0, NULL},
188181
};
189182

0 commit comments

Comments
 (0)