[Zodb-checkins] CVS: Zope3/lib/python/Persistence/BTrees - BTreeItemsTemplate.c:1.1.2.7

Tim Peters tim.one@comcast.net
Sun, 9 Jun 2002 18:24:30 -0400


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

Modified Files:
      Tag: Zope-3x-branch
	BTreeItemsTemplate.c 
Log Message:
Porting fixes from the trunk.


=== Zope3/lib/python/Persistence/BTrees/BTreeItemsTemplate.c 1.1.2.6 => 1.1.2.7 ===
 
           currentbucket = BUCKET(ITEMS(i->set)->currentbucket);
-
-          UNLESS(PER_USE(currentbucket)) return -1;
+          UNLESS(PER_USE(currentbucket))
+            {
+              /* Mark iteration terminated, so that finiSetIteration doesn't
+               * try to redundantly decref the key and value
+               */
+              i->position = -1;
+              return -1;
+            }
 
           COPY_KEY(i->key, currentbucket->keys[ITEMS(i->set)->currentoffset]);
           INCREF_KEY(i->key);
@@ -556,8 +562,14 @@
           Bucket *currentbucket;
 
           currentbucket = BUCKET(ITEMS(i->set)->currentbucket);
-
-          UNLESS(PER_USE(currentbucket)) return -1;
+          UNLESS(PER_USE(currentbucket))
+            {
+              /* Mark iteration terminated, so that finiSetIteration doesn't
+               * try to redundantly decref the key and value
+               */
+              i->position = -1;
+              return -1;
+            }
 
           COPY_KEY(i->key, currentbucket->keys[ITEMS(i->set)->currentoffset]);
           INCREF_KEY(i->key);