summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2020-03-11 18:31:10 -0500
committerJason Madden <jamadden@gmail.com>2020-03-18 12:27:20 -0500
commit1094bee45cc6d56f9f0e282dba6ca943577a1e7b (patch)
tree8f8869cf848c0abe50cd5167436367723967ba9d
parenta9d90f4418315098686bcff9b978ab2572000df9 (diff)
downloadzope-interface-1094bee45cc6d56f9f0e282dba6ca943577a1e7b.tar.gz
Several small tweaks to GC and deletion handling.
Several places needed to, essentially, call super.
-rw-r--r--src/zope/interface/_zope_interface_coptimizations.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/zope/interface/_zope_interface_coptimizations.c b/src/zope/interface/_zope_interface_coptimizations.c
index 5a4fc92..42debb3 100644
--- a/src/zope/interface/_zope_interface_coptimizations.c
+++ b/src/zope/interface/_zope_interface_coptimizations.c
@@ -330,6 +330,9 @@ Spec_clear(Spec* self)
static void
Spec_dealloc(Spec* self)
{
+ /* PyType_GenericAlloc that you get when you don't
+ specify a tp_alloc always tracks the object. */
+ PyObject_GC_UnTrack((PyObject *)self);
if (self->weakreflist != NULL) {
PyObject_ClearWeakRefs(OBJECT(self));
}
@@ -562,7 +565,7 @@ CPB_traverse(CPB* self, visitproc visit, void* arg)
{
Py_VISIT(self->_cls);
Py_VISIT(self->_implements);
- return 0;
+ return Spec_traverse((Spec*)self, visit, arg);
}
static int
@@ -570,14 +573,16 @@ CPB_clear(CPB* self)
{
Py_CLEAR(self->_cls);
Py_CLEAR(self->_implements);
+ Spec_clear((Spec*)self);
return 0;
}
static void
CPB_dealloc(CPB* self)
{
+ PyObject_GC_UnTrack((PyObject *)self);
CPB_clear(self);
- Py_TYPE(self)->tp_free(OBJECT(self));
+ Spec_dealloc((Spec*)self);
}
static PyMemberDef CPB_members[] = {
@@ -798,7 +803,7 @@ IB_traverse(IB* self, visitproc visit, void* arg)
{
Py_VISIT(self->__name__);
Py_VISIT(self->__module__);
- return 0;
+ return Spec_traverse((Spec*)self, visit, arg);
}
static int
@@ -806,14 +811,15 @@ IB_clear(IB* self)
{
Py_CLEAR(self->__name__);
Py_CLEAR(self->__module__);
- return 0;
+ return Spec_clear((Spec*)self);
}
static void
IB_dealloc(IB* self)
{
+ PyObject_GC_UnTrack((PyObject *)self);
IB_clear(self);
- Py_TYPE(self)->tp_free(OBJECT(self));
+ Spec_dealloc((Spec*)self);
}
static PyMemberDef IB_members[] = {