[ZODB-Dev] bug in slicing keys of BTrees
Andreas Jung
andreas@andreas-jung.com
Sat, 18 May 2002 14:48:53 -0400
Python passes 0 and MAX_INT to the __getslice__() method of BTreeItems.
Since the method does not check this special condition, it raises an
KeyError.
-aj
----- Original Message -----
From: "Steve Alexander" <steve@cat-box.net>
To: <zodb-dev@zope.org>
Sent: Saturday, May 18, 2002 15:18
Subject: [ZODB-Dev] bug in slicing keys of BTrees
> I've found this odd bug in the BTrees that is with Zope 3.
>
> I haven't verified it yet for the Zope2 version (if that is different).
>
> >>> from Persistence.BTrees import OOBTree
> >>> b=OOBTree.OOBTree({'a':1})
> >>> b.keys()
> <OOBTreeItems object at 0x81557c8>
> >>> b.keys()[:]
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> IndexError: 2147483647
> >>> [i for i in b.keys()]
> ['a']
> >>>
>
>
> --
> Steve Alexander
>
>
>
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>
> ZODB-Dev mailing list - ZODB-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zodb-dev
>