[Zodb-checkins] CVS: Zope/lib/python/BTrees - BTreeTemplate.c:1.52
Tim Peters
tim.one@comcast.net
Thu, 13 Jun 2002 16:08:40 -0400
Update of /cvs-repository/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv30371
Modified Files:
BTreeTemplate.c
Log Message:
BTree_rangeSearch(): Like its bucket counterpart, this wasn't checking
for lo > hi either, except if they happened to be in the same bucket. All
sorts of strange results followed (the range should be empty if lo > hi,
and is after this patch).
=== Zope/lib/python/BTrees/BTreeTemplate.c 1.51 => 1.52 ===
UNLESS (self->data && self->len) goto empty;
+ /* If f and l were both passed in, ensure f <= l. */
+ if (f && f != Py_None && l && l != Py_None)
+ {
+ int cmp;
+ KEY_TYPE first;
+ KEY_TYPE last;
+ int copied = 1;
+
+ COPY_KEY_FROM_ARG(first, f, copied);
+ UNLESS (copied) goto err;
+ COPY_KEY_FROM_ARG(last, l, copied);
+ UNLESS (copied) goto err;
+
+ TEST_KEY_SET_OR(cmp, first, last) goto err;
+ if (cmp > 0) goto empty;
+ }
+
/* Find the low range */
if (f && f != Py_None)