[ZODB-Dev] BTrees package problems
Christian Tismer
tismer at stackless.com
Tue Jul 23 03:06:07 CEST 2013
On 22.07.13 13:08, Jim Fulton wrote:
> On Sat, Jul 20, 2013 at 11:27 PM, Christian Tismer <tismer at stackless.com> wrote:
>> The BTrees package is an attempt to isolate certain things from ZODB.
>>
>> While I appreciate the general intent, I cannot see the advantage at
>> this point:
>>
>> - BTrees can be imported alone, yes. But it has the extensions prepared
>> with special ZODB slots, which makes this very questionable.
>>
>> - BTrees furthermore claims the BTrees global bame for it, all though it
>> is not a general BTree package, but for ZODB BTrees, only.
> Yeah, I worried about this when we broke it out.
>
> OTOH, there isn't much concern with namespace
> pollution in the Python community. :/
>
>> - BTrees has a serious bug, see the following example:
>>
>>>>>> from BTrees import OOBTree as BT
>>>>>> t = BT.BTree()
>>>>>> for num in range(100):
>>> ... k = str(num)
>>> ... t[k] = k
>>> ...
>>>>>> t._firstbucket._next = None
>>>>>> len(t)
>>> Bus error: 10
>>> (tmp)minimax:doc tismer$
> Ouch.
>
>> So there is either an omission to make t._next() read-only, or a check
>> of its validity is missing.
> Yup. OTOH, you're the first person to encounter this
> after many years, so while this is bad, and needs to be
> fixed, I'm not sure how serious it is as a practical matter.
>
>> Actually, I would like to add a callable-check instead, to allow for more
>> flexible derivatives.
> I don't understand this.
Simple: I am writing BTree forests for versioned, read-only databases.
For that, I need a way to create a version of Bucket that allows to
override the _next field by maybe a callable.
Otherwise all the buckets are chained together and I have no way
to let frozen BTrees share buckets.
When I played with the structure, I was happy/astonished to see the
_next field
being writable and thought it was intended to be so.
It was not, in the end ;-)
cheers - Chris
--
Christian Tismer :^) <mailto:tismer at stackless.com>
Software Consulting : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/
14482 Potsdam : PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776 fax +49 (30) 700143-0023
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the ZODB-Dev
mailing list