[Zope-Checkins] CVS: ZODB3/BTrees - BTreeModuleTemplate.c:1.37.92.6 BTreeTemplate.c:1.74.10.7 BucketTemplate.c:1.54.6.6 SetTemplate.c:1.16.52.4 TreeSetTemplate.c:1.15.52.4

Jeremy Hylton jeremy@zope.com
Thu, 10 Jul 2003 10:54:52 -0400


Update of /cvs-repository/ZODB3/BTrees
In directory cvs.zope.org:/tmp/cvs-serv31999/BTrees

Modified Files:
      Tag: zodb33-devel-branch
	BTreeModuleTemplate.c BTreeTemplate.c BucketTemplate.c 
	SetTemplate.c TreeSetTemplate.c 
Log Message:
Two mostly unrelated changes.

Make sure BTree dealloc functions call their base type's dealloc
function, which should be Per_dealloc().  This routine is responsible
for unlinked non-ghost objects from the cache ring and doing the right
refcount magic to safely remove it from the cache dict.

Remove po_weaklist and po_serial, which are ZODB4 specific.


=== ZODB3/BTrees/BTreeModuleTemplate.c 1.37.92.5 => 1.37.92.6 ===
--- ZODB3/BTrees/BTreeModuleTemplate.c:1.37.92.5	Mon Jul  7 15:56:03 2003
+++ ZODB3/BTrees/BTreeModuleTemplate.c	Thu Jul 10 10:54:41 2003
@@ -83,8 +83,6 @@
 #ifdef PERSISTENT
 #define sizedcontainer_HEAD         \
     cPersistent_HEAD                \
-    PyObject *po_serial;            \
-    PyObject *po_weaklist;          \
     int size;                       \
     int len;
 #else


=== ZODB3/BTrees/BTreeTemplate.c 1.74.10.6 => 1.74.10.7 ===
--- ZODB3/BTrees/BTreeTemplate.c:1.74.10.6	Wed Jul  9 14:39:06 2003
+++ ZODB3/BTrees/BTreeTemplate.c	Thu Jul 10 10:54:42 2003
@@ -1792,7 +1792,6 @@
 */
 
 static struct PyMemberDef BTree_members[] = {
-    {"_p_serial", T_OBJECT, offsetof(BTree, po_serial)},
     {"_firstbucket", T_OBJECT, offsetof(BTree, firstbucket), RO},
     {NULL}
 };
@@ -1897,14 +1896,9 @@
 static void
 BTree_dealloc(BTree *self)
 {
-    if (self->po_weaklist != NULL)
-        PyObject_ClearWeakRefs((PyObject *)self);
-    Py_XDECREF(self->jar);
-    Py_XDECREF(self->oid);
-    self->jar = NULL;
     if (self->state != cPersistent_GHOST_STATE)
 	_BTree_clear(self);
-    PyObject_GC_Del(self);
+    self->ob_type->tp_base->tp_dealloc((PyObject *)self);
 }
 
 static int
@@ -2072,7 +2066,7 @@
     (traverseproc)BTree_traverse,	/* tp_traverse */
     (inquiry)BTree_tp_clear,		/* tp_clear */
     0,					/* tp_richcompare */
-    offsetof(BTree, po_weaklist),	/* tp_weaklistoffset */
+    0,					/* tp_weaklistoffset */
     (getiterfunc)BTree_getiter,		/* tp_iter */
     0,					/* tp_iternext */
     BTree_methods,			/* tp_methods */


=== ZODB3/BTrees/BucketTemplate.c 1.54.6.5 => 1.54.6.6 ===
--- ZODB3/BTrees/BucketTemplate.c:1.54.6.5	Wed Jul  9 14:39:06 2003
+++ ZODB3/BTrees/BucketTemplate.c	Thu Jul 10 10:54:42 2003
@@ -1424,7 +1424,6 @@
 */
 
 static struct PyMemberDef Bucket_members[] = {
-    {"_p_serial", T_OBJECT, offsetof(Bucket, po_serial)},
     {"_next", T_OBJECT, offsetof(Bucket, next)},
     {NULL}
 };
@@ -1507,14 +1506,9 @@
 static void
 bucket_dealloc(Bucket *self)
 {
-    if (self->po_weaklist != NULL)
-        PyObject_ClearWeakRefs((PyObject *)self);
-    Py_XDECREF(self->jar);
-    Py_XDECREF(self->oid);
-    Py_XDECREF(self->po_serial);
     if (self->state != cPersistent_GHOST_STATE)
 	_bucket_clear(self);
-    PyObject_GC_Del(self);
+    self->ob_type->tp_base->tp_dealloc((PyObject *)self);
 }
 
 static int
@@ -1684,7 +1678,7 @@
     (traverseproc)bucket_traverse,	/* tp_traverse */
     (inquiry)bucket_tp_clear,		/* tp_clear */
     0,					/* tp_richcompare */
-    offsetof(Bucket, po_weaklist),	/* tp_weaklistoffset */
+    0,					/* tp_weaklistoffset */
     (getiterfunc)Bucket_getiter,	/* tp_iter */
     0,					/* tp_iternext */
     Bucket_methods,			/* tp_methods */


=== ZODB3/BTrees/SetTemplate.c 1.16.52.3 => 1.16.52.4 ===
--- ZODB3/BTrees/SetTemplate.c:1.16.52.3	Mon Jul  7 15:56:03 2003
+++ ZODB3/BTrees/SetTemplate.c	Thu Jul 10 10:54:42 2003
@@ -313,7 +313,7 @@
     (traverseproc)bucket_traverse,	/* tp_traverse */
     (inquiry)bucket_tp_clear,		/* tp_clear */
     0,					/* tp_richcompare */
-    offsetof(Bucket, po_weaklist),	/* tp_weaklistoffset */
+    0,					/* tp_weaklistoffset */
     (getiterfunc)Bucket_getiter,	/* tp_iter */
     0,					/* tp_iternext */
     Set_methods,			/* tp_methods */


=== ZODB3/BTrees/TreeSetTemplate.c 1.15.52.3 => 1.15.52.4 ===
--- ZODB3/BTrees/TreeSetTemplate.c:1.15.52.3	Mon Jul  7 15:56:03 2003
+++ ZODB3/BTrees/TreeSetTemplate.c	Thu Jul 10 10:54:42 2003
@@ -227,7 +227,7 @@
     (traverseproc)BTree_traverse,	/* tp_traverse */
     (inquiry)BTree_tp_clear,		/* tp_clear */
     0,					/* tp_richcompare */
-    offsetof(BTree, po_weaklist),	/* tp_weaklistoffset */
+    0,					/* tp_weaklistoffset */
     (getiterfunc)BTree_getiter,		/* tp_iter */
     0,					/* tp_iternext */
     TreeSet_methods,			/* tp_methods */