Skip to content

Commit 76b07c0

Browse files
gh-116946: partial revert gh-139073 for thread handle type (#139474)
1 parent 0158890 commit 76b07c0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/_threadmodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ static void
660660
PyThreadHandleObject_dealloc(PyObject *op)
661661
{
662662
PyThreadHandleObject *self = PyThreadHandleObject_CAST(op);
663+
PyObject_GC_UnTrack(self);
663664
PyTypeObject *tp = Py_TYPE(self);
664665
ThreadHandle_decref(self->handle);
665666
tp->tp_free(self);
@@ -747,6 +748,7 @@ static PyType_Slot ThreadHandle_Type_slots[] = {
747748
{Py_tp_dealloc, PyThreadHandleObject_dealloc},
748749
{Py_tp_repr, PyThreadHandleObject_repr},
749750
{Py_tp_getset, ThreadHandle_getsetlist},
751+
{Py_tp_traverse, _PyObject_VisitType},
750752
{Py_tp_methods, ThreadHandle_methods},
751753
{Py_tp_new, PyThreadHandleObject_tp_new},
752754
{0, 0}
@@ -756,7 +758,7 @@ static PyType_Spec ThreadHandle_Type_spec = {
756758
"_thread._ThreadHandle",
757759
sizeof(PyThreadHandleObject),
758760
0,
759-
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
761+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC,
760762
ThreadHandle_Type_slots,
761763
};
762764

0 commit comments

Comments
 (0)