https://github.com/python/cpython/commit/76b07c035c224fdfd7bafe5dbc087d0e88469c62
commit: 76b07c035c224fdfd7bafe5dbc087d0e88469c62
branch: main
author: Kumar Aditya <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-10-01T17:49:31Z
summary:
gh-116946: partial revert gh-139073 for thread handle type (#139474)
files:
M Modules/_threadmodule.c
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index b43bf5e97d81a6..cc8277c5783858 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -660,6 +660,7 @@ static void
PyThreadHandleObject_dealloc(PyObject *op)
{
PyThreadHandleObject *self = PyThreadHandleObject_CAST(op);
+ PyObject_GC_UnTrack(self);
PyTypeObject *tp = Py_TYPE(self);
ThreadHandle_decref(self->handle);
tp->tp_free(self);
@@ -747,6 +748,7 @@ static PyType_Slot ThreadHandle_Type_slots[] = {
{Py_tp_dealloc, PyThreadHandleObject_dealloc},
{Py_tp_repr, PyThreadHandleObject_repr},
{Py_tp_getset, ThreadHandle_getsetlist},
+ {Py_tp_traverse, _PyObject_VisitType},
{Py_tp_methods, ThreadHandle_methods},
{Py_tp_new, PyThreadHandleObject_tp_new},
{0, 0}
@@ -756,7 +758,7 @@ static PyType_Spec ThreadHandle_Type_spec = {
"_thread._ThreadHandle",
sizeof(PyThreadHandleObject),
0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC,
ThreadHandle_Type_slots,
};
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]