[ZODB-Dev] Default comparison considered harmful in BTrees.

Jim Fulton jim at zope.com
Wed Oct 27 12:45:09 EDT 2010


On Wed, Oct 27, 2010 at 11:27 AM, Hanno Schlichting <hanno at hannosch.eu> wrote:
> On Wed, Oct 27, 2010 at 3:58 PM, Jim Fulton <jim at zope.com> wrote:
>> On Wed, Oct 27, 2010 at 9:17 AM, Hanno Schlichting <hanno at hannosch.eu> wrote:
>>> I'm now getting warnings for simple strings and ints, I'd expect
>>> tuples as well.
>>
>> That's odd. I'm not. What platform and Python version?
>
> Python 2.6.6, Mac OS 10.6.4 64bit
>
>> Can you give some examples?
>
> Basically all data structures in the ZCatalog throw warnings now. They
> often look like this:
>
> (Pdb) self._index
> <BTrees.OOBTree.OOBTree object at 0x107bcf950>
> (Pdb) self._index['plone']
> <BTrees.IOBTree.IOBTree object at 0x1092eeb50>
> (Pdb) self._index['plone'][0]
> <BTrees.IIBTree.IITreeSet object at 0x1092eebd0>
> (Pdb) [a for a in self._index['plone'][0]]
> [1744389888]

Hm, it looks like you're using a debug build.  I wonder if that matters.
I doubt it.

>
> I get warnings for lines like:
>
> 'string' in self._index
> self._index['string'][0] = IITreeSet()

Um, I don't see any warnings in your example.

Can you show any examples that don't involve existing indexes?

If not, I wonder if the existing indexes have some bad values in
them that are triggering this somehow.  The relevant check is being done
when loading state.  I bet you have some bad keys (e.g. None) in your
data structures. Could you check that?  If this is what's happening, then
I think the warning is useful.  For 3.11 though (aka trunk) I'll
rearrange things
so the check isn't performed when loading state.

Jim

-- 
Jim Fulton


More information about the ZODB-Dev mailing list