[Zope-Checkins] CVS: Zope3/lib/python/Persistence/BTrees - BTreeTemplate.c:1.1.2.18 BucketTemplate.c:1.1.2.17

Tim Peters tim.one@comcast.net
Thu, 6 Jun 2002 12:26:36 -0400


Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv13503

Modified Files:
      Tag: Zope-3x-branch
	BTreeTemplate.c BucketTemplate.c 
Log Message:
Disabling bucket and BTree gc traversal "fixes" the failures in the
Persistence tests, so this patch disables them.

It doesn't look like they're the true cause, though.  There are a variety
of "senseless" failures when they're enabled, varying between release and
debug builds, and look more like gc is stumbling into some other problem
than it is created problems.  So this patch is most likely letting the
tests pass by accident.

Also reworked the traversals to give up if the object is already registered
with the persistence mechanisms.  Jeremy suggested this, and it sounds like
a good idea to me too.


=== Zope3/lib/python/Persistence/BTrees/BTreeTemplate.c 1.1.2.17 => 1.1.2.18 ===
     int err = 0;
     int i, len;
-
-    /* XXX doesn't this routine need to unghostify? */
+    
+    /* XXX Unclear whether this routine causes a problem or merely reveals a
+     * XXX different problem.
+     */
+    return 0;
 
 #define VISIT(SLOT)                             \
     if (SLOT) {                                 \
         err = visit((PyObject *)(SLOT), arg);   \
         if (err)                                \
-            goto Error;                         \
+            goto Done;                          \
     }
 
+    assert(self->ob_type->tp_dictoffset == 0);
+
     err = PyPersist_BASE_TYPE->tp_traverse((PyObject *)self, visit, arg);
     if (err)
-	goto Error;
+	goto Done;
+
+    if (self->po_oid != NULL)
+        goto Done;
+    assert(self->po_state != GHOST);
 
     len = self->len;
     if (KEY_IF_OBJECT(self) != NULL) {
@@ -1299,8 +1308,7 @@
 
     VISIT(self->firstbucket);
 
-Error:
-    /* XXX I figure an "end persistence dance" probably belongs here */
+Done:
     return err;
 
 #undef VISIT


=== Zope3/lib/python/Persistence/BTrees/BucketTemplate.c 1.1.2.16 => 1.1.2.17 ===
     int i, len;
 
-    /* XXX doesn't this routine need to unghostify? */
+    /* XXX Unclear whether this routine causes a problem or merely reveals a
+     * XXX different problem.
+     */
+    return 0;
 
 #define VISIT(SLOT)                             \
     if (SLOT) {                                 \
         err = visit((PyObject *)(SLOT), arg);   \
         if (err)                                \
-            goto Error;                         \
+            goto Done;                          \
     }
 
+    assert(self->ob_type->tp_dictoffset == 0);
+
     err = PyPersist_BASE_TYPE->tp_traverse((PyObject *)self, visit, arg);
     if (err)
-	goto Error;
+	goto Done;
+
+    if (self->po_oid != NULL)
+        goto Done;
+    assert(self->po_state != GHOST);
 
     len = self->len;
     if (KEY_IF_OBJECT(self) != NULL) {
@@ -1215,8 +1224,7 @@
 
     VISIT(self->next);
 
-Error:
-    /* XXX I figure an "end persistence dance" probably belongs here */
+Done:
     return err;
 
 #undef VISIT