[Zope-Checkins] CVS: Packages/BTrees - BucketTemplate.c:1.54.4.3

Tim Peters tim.one at comcast.net
Mon Jul 18 15:41:05 EDT 2005


Update of /cvs-repository/Packages/BTrees
In directory cvs.zope.org:/tmp/cvs-serv4422/BTrees

Modified Files:
      Tag: Zope-2_7-branch
	BucketTemplate.c 
Log Message:
Backport from ZODB 3.4.

Collector 1843:  IISet.keys: bad exception handling.

Bucket_rangeSearch():  De-obfuscated the calls to
Bucket_findRangeEnd(), so that they stop ignoring
the latter's error returns (a mind-bending combination
of embedded assignment nested in an UNLESS macro,
seemingly copy+paste'd so that the error occurred twice).


=== Packages/BTrees/BucketTemplate.c 1.54.4.2 => 1.54.4.3 ===
--- Packages/BTrees/BucketTemplate.c:1.54.4.2	Tue Jul  5 12:41:33 2005
+++ Packages/BTrees/BucketTemplate.c	Mon Jul 18 15:40:34 2005
@@ -742,35 +742,36 @@
   PyObject *f=0, *l=0;
   int rc;
 
-  if (args && ! PyArg_ParseTuple(args,"|OO",&f, &l)) return -1;
+  if (args && ! PyArg_ParseTuple(args,"|OO",&f, &l))
+      return -1;
 
   UNLESS (self->len) goto empty;
 
   /* Find the low range */
-  if (f && f != Py_None)
-    {
-      UNLESS (rc = Bucket_findRangeEnd(self, f, 1, low))
-        {
-          if (rc < 0) return -1;
+  if (f && f != Py_None) {
+      rc = Bucket_findRangeEnd(self, f, 1, low);
+      if (rc < 0)
+          return -1;
+      if (rc == 0)
           goto empty;
-        }
-    }
-  else *low = 0;
+  }
+  else
+      *low = 0;
 
   /* Find the high range */
-  if (l && l != Py_None)
-    {
-      UNLESS (rc = Bucket_findRangeEnd(self, l, 0, high))
-        {
-          if (rc < 0) return -1;
-          goto empty;
-        }
-    }
-  else *high = self->len - 1;
+  if (l && l != Py_None) {
+       rc = Bucket_findRangeEnd(self, l, 0, high);
+       if (rc < 0)
+           return -1;
+       if (rc == 0)
+           goto empty;
+  }
+  else
+      *high = self->len - 1;
 
   /* If f < l to begin with, it's quite possible that low > high now. */
   if (*low <= *high)
-    return 0;
+      return 0;
 
  empty:
   *low = 0;



More information about the Zope-Checkins mailing list