Skip to content

Commit 5f1eae2

Browse files
authored
Merge pull request #85 from fxpl/immutable-reachable-for-python-types
Set `tp_reachable` for Python classes
2 parents b4d2807 + f764719 commit 5f1eae2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Python/bltinmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ builtin___build_class__(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
232232
Py_DECREF(cell_cls);
233233
}
234234
}
235+
if (cls != NULL && PyType_Check(cls)) {
236+
PyTypeObject *tp = _PyType_CAST(cls);
237+
tp->tp_reachable = tp->tp_traverse;
238+
}
235239
}
236240
error:
237241
Py_XDECREF(cell);

0 commit comments

Comments
 (0)