1. 13 Jun, 2002 7 commits
    • Tim Peters's avatar
      New method _build_degenerate_tree() builds a horridly degenerate (but · 6cd24e99
      Tim Peters authored
      legitimate) BTree.  New test testDegenerateBasicOps() does basic sanity
      checks on it.  More tests against this tree will follow.
      6cd24e99
    • Tim Peters's avatar
      test_suite(): Yikes! Typos in this function caused us to skip some test · 20319484
      Tim Peters authored
      classes entirely (like for IITreeSets), and to run other test classes
      twice.
      20319484
    • Tim Peters's avatar
      BTree_rangeSearch(): Squash another case of bucket-leak-on-PER_USE-failure, · d9e0c3eb
      Tim Peters authored
      plus cleanup of a previous such fix.
      d9e0c3eb
    • Tim Peters's avatar
      BTree_maxminKey(): Fixed three places where a PER_USE failure leaked a · 71098d51
      Tim Peters authored
      bucket reference.
      
      BTree_rangeSearch():  Fixed one place likewise.
      71098d51
    • Tim Peters's avatar
      BTree_findRangeEnd(): Rearranged the persistence macros to cut down a · a0e097bb
      Tim Peters authored
      little on redundant activations.
      a0e097bb
    • Tim Peters's avatar
      BTree_findRangeEnd(): Fixed "the range search bug": if the smallest · d82d25a3
      Tim Peters authored
      key S in a bucket in a BTree is deleted, doing a range search on the
      BTree with S on the high end may claim that the range is empty even when
      it's not.  It proved difficult to fix this correctly and efficiently in
      all cases (our BTrees don't like "searching backwards").  The
      implementation here is a new and non-recursive one (in effect, to do
      this efficiently you have to remember the deepest point in the tree where
      it was *possible* to "go one left" of where binary search tells you to go;
      an iterative algorithm makes that part all but obvious).  Alas, the
      number of uses of persistence macros is amazing, unfortunately making
      this still-hairy algorithm hard to follow.
      
      testPathologicalRangeSearch():  uncommented the lines that failed
      before this patch.  They pass now.
      
      Insecurity:  The test case only exercises the simplest possible form
      of the failure.  Any failing case is hard to provoke, even the simplest.
      The hairier failing cases require generating degenerate trees, deep
      and with some interior nodes near the top having just one or two children
      (since the tree needs to be deep too, that isn't easy to provoke).  I'll
      think about how to provoke this without needing to build up multi-million
      element trees first; maybe using __setstate__ directly is the answer.
      d82d25a3
    • Tim Peters's avatar
      BTree_lastBucket(): documented what this returns (between who owns · 130af61d
      Tim Peters authored
      references, what must not be and what may be a ghost, and exactly what
      "last" means, it was surprisingly unclear).  Also simplified the
      implementation (to my eyes -- it's arguable, but I'm the one working
      on it, so my eyes count <wink>).  I believe this routine is key to
      fixing the range-search bug efficiently.
      130af61d
  2. 12 Jun, 2002 10 commits
  3. 11 Jun, 2002 12 commits
  4. 10 Jun, 2002 7 commits
  5. 09 Jun, 2002 4 commits
    • Tim Peters's avatar
      nextBTreeItems() and nextTreeSetItems(): unlike the other set iteration · ec683139
      Tim Peters authored
      "next" functions, these can return a PER_USE() error *after* decrefing
      the keys and values left over from the last call.  But they don't mark
      the iteration as terminated, so finiSetIteration() will also try to
      decref the leftovers.  The fix is to mark the iteration as terminated
      when these functions fail.
      ec683139
    • Tim Peters's avatar
      Fix for http://collector.zope.org/Zope/419, · f6a898f9
      Tim Peters authored
      "BTreeItems slice contains 1 too many elements"
      This also fixes many related glitches, such as that giving an
      out-of-bound slice index raised IndexError instead of clipping.
      
      BTreeItems_slice():  Emulate Python slicing semantics in all cases.
      
      testBTrees.py:  new testSlicing() tests in MappingBase and NormalSetTests
      to ensure that slicing of .keys()/.items()/.values() works exactly the
      same way as slicing of Python lists, in all one-sided, two-sided and
      whole-structure ([:]) cases, with both negative and positive slice indices,
      and mixtures of + and -, and whether in bounds or out of bounds.
      f6a898f9
    • Tim Peters's avatar
      Trimmed trailing whitespace. · 918da832
      Tim Peters authored
      918da832
    • Tim Peters's avatar
      Trimmed trailing whitespace. · 585f31ad
      Tim Peters authored
      585f31ad