cslots: Objects with the metaclass also do not particpate in cyclic gc.

This commit is contained in:
Tom Rothamel
2024-12-27 15:16:53 -05:00
parent e207fdc435
commit 423f544dc9
+9 -1
View File
@@ -243,7 +243,15 @@ class Metaclass(type):
namespace["_cslot_map"] = cslot_map
namespace["_cslot_list"] = cslot_list
return type.__new__(cls, name, bases, namespace)
rv = type.__new__(cls, name, bases, namespace)
cdef PyTypeObject *pto = <PyTypeObject *> rv
pto.tp_flags = pto.tp_flags & ~(Py_TPFLAGS_HAVE_GC)
pto.tp_traverse = NULL
pto.tp_clear = NULL
pto.tp_dealloc = <void (*)(PyObject *) noexcept> PyObject_Free
return rv
class Object(CObject, metaclass=Metaclass):