Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
The _thread.RLock type now fully implement the GC protocol: add a traverse
function and the :const:`Py_TPFLAGS_HAVE_GC` flag. Patch by Victor Stinner.
11 changes: 10 additions & 1 deletion Modules/_threadmodule.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -327,6 +327,14 @@ typedef struct{
PyObject *in_weakreflist;
} rlockobject;

static int
rlock_traverse(rlockobject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
return 0;
}


static void
rlock_dealloc(rlockobject *self)
{
Expand DownExpand Up@@ -579,13 +587,14 @@ static PyType_Slot rlock_type_slots[] ={
{Py_tp_alloc, PyType_GenericAlloc},
{Py_tp_new, rlock_new},
{Py_tp_members, rlock_type_members},
{Py_tp_traverse, rlock_traverse},
{0, 0},
};

static PyType_Spec rlock_type_spec ={
.name = "_thread.RLock",
.basicsize = sizeof(rlockobject),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
.slots = rlock_type_slots,
};

Expand Down