[Zodb-checkins] CVS: Zope3/lib/python/Persistence/BTrees - BucketTemplate.c:1.1.2.13

Tim Peters tim.one@comcast.net
Wed, 5 Jun 2002 14:52:57 -0400


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

Modified Files:
      Tag: Zope-3x-branch
	BucketTemplate.c 
Log Message:
Repaired the last known case where the new pass-along-comparison-errors
code from the trunk failed to finish the persistence dance.  There are
still cases of this on the trunk, though (which I'll fix next).


=== Zope3/lib/python/Persistence/BTrees/BucketTemplate.c 1.1.2.12 => 1.1.2.13 ===
   for (min=0, max=self->len, i=max/2, l=max; i != l; l=i, i=(min+max)/2) 
     {
-      /* XXX should this do a PyPersist_I'm_Done dance on failure?
-       * XXX The trunk code doesn't, but it doesn't feel right there either.
-       */
-      TEST_KEY_SET_OR(cmp, self->keys[i], key) return -1;
+      TEST_KEY_SET_OR(cmp, self->keys[i], key) goto Error;
       if (cmp < 0)
 	min=i;
       else if (cmp == 0)
@@ -528,6 +525,11 @@
   PyPersist_SetATime(self);
 
   return i;
+
+Error:
+  PyPersist_DECREF(self);
+  PyPersist_SetATime(self);
+  return -1;
 }
 
 static PyObject *